GRINS-0.8.0
parsed_viscosity.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 // This class
27 #include "grins/parsed_viscosity.h"
28 
29 //GRINS
30 #include "grins/physics_naming.h"
31 #include "grins/common.h"
32 
33 // libMesh
34 #include "libmesh/getpot.h"
35 
36 namespace GRINS
37 {
38 
39  ParsedViscosity::ParsedViscosity( const GetPot& input )
41  ParameterUser("ParsedViscosity"),
43  {
44 
45  // Warning about this constructor being deprecated
46  {
47  std::string warning = "WARNING: Use of this constructor is DEPRECATED.\n";
48  warning += " Please update to use constructor with input material name.\n";
49  grins_warning(warning);
50  }
51 
52  this->set_parameter(this->_func, input,
53  "Materials/Viscosity/mu",
54  "DIE!");
55 
56  std::string viscosity_function = input("Materials/Viscosity/mu",std::string("0"));
57 
58  if( !this->check_func_nonzero(viscosity_function) )
59  {
60  libmesh_error_msg("ERROR: Detected '0' function for ParsedConductivity!");
61  }
62  }
63 
64  ParsedViscosity::ParsedViscosity( const GetPot& input, const std::string& material )
65  : ParameterUser("ParsedViscosity"),
67  {
68  this->check_input_consistency(input,material);
69 
70  std::string viscosity_function = "0";
71 
72  // If we have the new version, we parse that
73  if( input.have_variable("Materials/"+material+"/Viscosity/value") )
74  {
75  this->set_parameter(this->_func, input,
76  "Materials/"+material+"/Viscosity/value",
77  "DIE!");
78 
79  viscosity_function = input("Materials/"+material+"/Viscosity/value",std::string("0"));
80  }
81  // If we have the old DEPRECATED version, use that
82  else if( input.have_variable("Materials/Viscosity/mu") )
83  {
84  this->old_mu_warning();
85 
86  this->set_parameter(this->_func, input,
87  "Materials/Viscosity/mu",
88  "DIE!");
89 
90  viscosity_function = input("Materials/Viscosity/mu",std::string("0"));
91  }
92  // If we don't have either, that's an error
93  else
94  {
95  libmesh_error_msg("Error: Could not find either Materials/"+material+"/Viscosity/value or Materials/Viscosity/mu");
96  }
97 
98  if( !this->check_func_nonzero(viscosity_function) )
99  {
100  libmesh_error_msg("ERROR: Detected '0' function for ParsedConductivity!");
101  }
102  }
103 
105  {
106  return;
107  }
108 
109 } // namespace GRINS
libMesh::ParsedFunction< libMesh::Number > _func
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.
void old_mu_warning() const
#define grins_warning(message)
Definition: common.h:34
Base class for viscosity models.
bool check_func_nonzero(const std::string &function) const
Returns true if function string is nonzero.
GRINS namespace.
ParameterUser base class. Utility methods for subclasses.
Base class for material properties based on ParsedFunction.
void check_input_consistency(const GetPot &input, const std::string &material) const

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