GRINS-0.7.0
List of all members | Public Member Functions | Protected Member Functions | Protected Attributes
GRINS::FEVariablesBase Class Referenceabstract

#include <fe_variables_base.h>

Inheritance diagram for GRINS::FEVariablesBase:
Inheritance graph
[legend]

Public Member Functions

 FEVariablesBase (bool is_constraint_var)
 
 ~FEVariablesBase ()
 
virtual void init (libMesh::FEMSystem *system)=0
 Add variables to the system. More...
 
bool is_constraint_var () const
 
void set_neumann_bc_is_positive (bool is_positive)
 Reset whetever Neumann bc is postive or not. More...
 
libMesh::Real neumann_bc_sign () const
 
const std::vector< std::string > & active_var_names () const
 Return the var names that are active from this class. More...
 
const std::vector< VariableIndex > & var_indices () const
 

Protected Member Functions

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. More...
 
void duplicate_name_section_check (const GetPot &input) const
 Check for old name style and new name style. If both present, error. More...
 
bool check_dep_name_input (const GetPot &input, const std::string &new_subsection) const
 Check for deprecated variable name input style. More...
 

Protected Attributes

std::vector< VariableIndex_vars
 
std::vector< std::string > _var_names
 
std::vector< GRINSEnums::FEFamily > _family
 
std::vector< GRINSEnums::Order > _order
 
bool _is_constraint_var
 Tracks whether this is a constraint variable. More...
 
libMesh::Real _neumann_bc_sign
 Track the sign of the Neumann BC term. Defaults to 1.0. More...
 

Detailed Description

Definition at line 53 of file fe_variables_base.h.

Constructor & Destructor Documentation

GRINS::FEVariablesBase::FEVariablesBase ( bool  is_constraint_var)
inline

Definition at line 57 of file fe_variables_base.h.

59  _neumann_bc_sign(1.0)
60  {}
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.
bool is_constraint_var() const
GRINS::FEVariablesBase::~FEVariablesBase ( )
inline

Definition at line 62 of file fe_variables_base.h.

62 {};

Member Function Documentation

const std::vector<std::string>& GRINS::FEVariablesBase::active_var_names ( ) const
inline
bool GRINS::FEVariablesBase::check_dep_name_input ( const GetPot &  input,
const std::string &  new_subsection 
) const
protected

Check for deprecated variable name input style.

If found, this returns true and emits a deprecated warning. Otherwise, this returns false. The string argument is supplied by each variable class for the warning message. E.g. if the variable class is going to look in "Displacement", i.e. [Variables/Displacement/names], then "Displacement" should be passed.

Definition at line 59 of file fe_variables_base.C.

References duplicate_name_section_check(), grins_warning, and GRINS::VariablesParsing::varnames_input_name().

Referenced by GRINS::MultiVarSingleFETypeVariable::MultiVarSingleFETypeVariable(), and GRINS::SingleVarSingleFETypeVariable::SingleVarSingleFETypeVariable().

61  {
62  this->duplicate_name_section_check(input);
63 
64  bool is_old_input_style = false;
65 
66  if( input.have_section("Physics/VariableNames") )
67  {
68  is_old_input_style = true;
69 
70  std::string warning = "WARNING: Specifying variable names with Physics/VariableNames is DEPRECATED!\n";
71  warning += " Please update to use ["+VariablesParsing::varnames_input_name(subsection)+"].\n";
72  grins_warning(warning);
73  }
74 
75  return is_old_input_style;
76  }
#define grins_warning(message)
Definition: common.h:34
static std::string varnames_input_name(const std::string &subsection)
Helper function to encapsulate the names variable in the input file.
void duplicate_name_section_check(const GetPot &input) const
Check for old name style and new name style. If both present, error.
void GRINS::FEVariablesBase::duplicate_name_section_check ( const GetPot &  input) const
protected

Check for old name style and new name style. If both present, error.

Old name style: [Physics/VariableNames] New name style: [Variables/<variable type>="">] Here, we just check for the presence of the sections [Physics/VariableNames] and [Variables].

Definition at line 51 of file fe_variables_base.C.

References GRINS::VariablesParsing::variables_section().

Referenced by check_dep_name_input().

52  {
53  if( input.have_section("Physics/VariableNames") &&
54  input.have_section(VariablesParsing::variables_section()) )
55  libmesh_error_msg("ERROR: Cannot have both Physics/VariableNames and "
56  +VariablesParsing::variables_section()+" in input!");
57  }
static std::string variables_section()
Helper function to encapsualte the overall [Variables] section name.
virtual void GRINS::FEVariablesBase::init ( libMesh::FEMSystem *  system)
pure virtual

Add variables to the system.

This expects that _var_names has been setup during construction time. Most subclasses should be able to use default_fe_init, once they subclass this and VariablesBase.

Implemented in GRINS::SingleFETypeVariable, GRINS::DisplacementFEVariables, and GRINS::VelocityFEVariables.

bool GRINS::FEVariablesBase::is_constraint_var ( ) const
inline
libMesh::Real GRINS::FEVariablesBase::neumann_bc_sign ( ) const
inline

Definition at line 79 of file fe_variables_base.h.

References _neumann_bc_sign.

Referenced by GRINS::MultiphysicsSystem::apply_neumann_bcs().

80  { return _neumann_bc_sign; }
libMesh::Real _neumann_bc_sign
Track the sign of the Neumann BC term. Defaults to 1.0.
void GRINS::FEVariablesBase::parse_names_from_input ( const GetPot &  input,
const std::string &  subsection,
std::vector< std::string > &  var_names,
const std::vector< std::string > &  default_names 
)
protected

Method to parse variable names from input.

Names parsed from: [Variables/<subsection>/names] and then populated into the supplied var_names vector. It is assumed that var_names has been properly sized, that default_names and var_names have the same size, and that default_names has been populated with unique strings.

Definition at line 38 of file fe_variables_base.C.

References GRINS::VariablesParsing::varnames_input_name().

Referenced by GRINS::MultiVarSingleFETypeVariable::MultiVarSingleFETypeVariable(), and GRINS::SingleVarSingleFETypeVariable::SingleVarSingleFETypeVariable().

42  {
43  libmesh_assert_equal_to( var_names.size(), default_names.size() );
44 
45  unsigned int n_names = default_names.size();
46 
47  for( unsigned int n = 0; n < n_names; n++ )
48  var_names[n] = input(VariablesParsing::varnames_input_name(subsection), default_names[n], n);
49  }
static std::string varnames_input_name(const std::string &subsection)
Helper function to encapsulate the names variable in the input file.
void GRINS::FEVariablesBase::set_neumann_bc_is_positive ( bool  is_positive)
inline

Reset whetever Neumann bc is postive or not.

Postive means a value of 1.0 will be used in front of NeumannBC terms while is_positive = false indicates a value of -1.0 should be used.

Definition at line 145 of file fe_variables_base.h.

References _neumann_bc_sign.

Referenced by GRINS::SolidMechanicsAbstract::SolidMechanicsAbstract().

146  {
147  if(is_positive)
148  _neumann_bc_sign = 1.0;
149  else
150  _neumann_bc_sign = -1.0;
151  }
libMesh::Real _neumann_bc_sign
Track the sign of the Neumann BC term. Defaults to 1.0.
const std::vector<VariableIndex>& GRINS::FEVariablesBase::var_indices ( ) const
inline

Member Data Documentation

std::vector<GRINSEnums::FEFamily> GRINS::FEVariablesBase::_family
protected
bool GRINS::FEVariablesBase::_is_constraint_var
protected

Tracks whether this is a constraint variable.

By constraint variable, we mean a variable that is effectively a Lagrange multiplier. The intended use case is to determine whether this variable requires boundary conditions to be specified (constraint variables do not).

Definition at line 135 of file fe_variables_base.h.

Referenced by is_constraint_var().

libMesh::Real GRINS::FEVariablesBase::_neumann_bc_sign
protected

Track the sign of the Neumann BC term. Defaults to 1.0.

Depending on the Physics/Variable combination, the sign in front of the Neumann boundary term can change.

Definition at line 140 of file fe_variables_base.h.

Referenced by neumann_bc_sign(), and set_neumann_bc_is_positive().

std::vector<GRINSEnums::Order> GRINS::FEVariablesBase::_order
protected
std::vector<std::string> GRINS::FEVariablesBase::_var_names
protected
std::vector<VariableIndex> GRINS::FEVariablesBase::_vars
protected

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

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