GRINS-0.8.0
parsed_function_neumann_bc_factory_helper.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 // This class
27 
28 // GRINS
30 
31 // libMesh
32 #include "libmesh/getpot.h"
33 
34 namespace GRINS
35 {
36  template<typename FunctionType>
37  SharedPtr<NeumannBCAbstract>
39  MultiphysicsSystem& system,
40  const FEVariablesBase& fe_var,
41  const std::string& flux_input )
42  {
43  const std::vector<std::string>& var_names = fe_var.active_var_names();
44 
45  SharedPtr<NeumannBCAbstract> func;
46 
47  // Use "standard" parsed version if there's only one variable
48  if( var_names.size() == 1 )
49  {
50  libmesh_assert_equal_to( fe_var.var_indices().size(), 1 );
51  std::string expression = input(flux_input,std::string("DIE!"));
52  func = this->build_parsed_neumann_func(system,expression,fe_var.var_indices()[0]);
53  }
54  // Otherwise, use the composite versions
55  else
56  {
57  libmesh_assert_equal_to( fe_var.var_indices().size(), var_names.size() );
58 
59  // We already checked size consistency for flux input and var_names
60  // so just use var_names for the size
61  std::vector<std::string> expressions(var_names.size());
62 
63  for( unsigned int i = 0; i < var_names.size(); i++ )
64  expressions[i] = input(flux_input,std::string("DIE!"),i);
65 
66  func = this->build_composite_parsed_neumann_func(system,expressions,fe_var.var_indices());
67  }
68 
69  return func;
70  }
71 
72  template<>
73  SharedPtr<NeumannBCAbstract>
75  (MultiphysicsSystem& /*system*/, const std::string& expression, VariableIndex var_idx )
76  {
77  return SharedPtr<NeumannBCAbstract>( new ParsedNeumannBC<libMesh::Number>(expression,var_idx) );
78  }
79 
80  template<>
81  SharedPtr<NeumannBCAbstract>
83  (MultiphysicsSystem& system, const std::string& expression, VariableIndex var_idx )
84  {
85  return SharedPtr<NeumannBCAbstract>( new ParsedFEMNeumannBC<libMesh::Number>(expression,system,var_idx) );
86  }
87 
88  template<>
89  SharedPtr<NeumannBCAbstract>
91  (MultiphysicsSystem& /*system*/, const std::vector<std::string>& expressions,
92  const std::vector<VariableIndex>& var_indices )
93  {
94  return SharedPtr<NeumannBCAbstract>( new CompositeParsedNeumannBC<libMesh::Number>(expressions,var_indices) );
95  }
96 
97  template<>
98  SharedPtr<NeumannBCAbstract>
100  (MultiphysicsSystem& system, const std::vector<std::string>& expressions,
101  const std::vector<VariableIndex>& var_indices )
102  {
103  return SharedPtr<NeumannBCAbstract>( new CompositeParsedFEMNeumannBC<libMesh::Number>(expressions,var_indices,system) );
104  }
105 
106  // Instantiate
109 
110 } // end namespace GRINS
unsigned int VariableIndex
More descriptive name of the type used for variable indices.
Definition: var_typedefs.h:42
GRINS namespace.
SharedPtr< NeumannBCAbstract > build_neumman_func_common(const GetPot &input, MultiphysicsSystem &system, const FEVariablesBase &fe_var, const std::string &flux_input)
Helper function containing common code.
Interface with libMesh for solving Multiphysics problems.
const std::vector< std::string > & active_var_names() const
Return the var names that are active from this class.
const std::vector< VariableIndex > & var_indices() const

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