GRINS-0.8.0
constant_specific_heat.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
28 
29 // GRINS
30 #include "grins/common.h"
32 
33 // libMesh
34 #include "libmesh/getpot.h"
35 
36 namespace GRINS
37 {
38 
40  : ParameterUser("ConstantSpecificHeat"),
41  _cp(0.0)
42  {
43  // Warning about this constructor being deprecated
44  {
45  std::string warning = "WARNING: Use of this constructor is DEPRECATED.\n";
46  warning += " Please update to use constructor with input material name.\n";
47  grins_warning(warning);
48  }
49 
50  if( !input.have_variable("Materials/SpecificHeat/cp") )
51  {
52  std::cerr << "Error: Must specify cp value for constant specific heat model!" << std::endl;
53  libmesh_error();
54  }
55 
56  this->set_parameter
57  (_cp, input, "Materials/SpecificHeat/cp", _cp);
58  }
59 
61  const std::string& material )
62  : ParameterUser("ConstantSpecificHeat"),
63  _cp(0.0)
64  {
65  // It's an error to have both the old and new version
67  "Materials/"+material+"/SpecificHeat/value",
68  "Materials/SpecificHeat/cp");
69 
70  // If we have the "new" version, then parse it
71  if( input.have_variable("Materials/"+material+"/SpecificHeat/value") )
72  {
73  this->set_parameter
74  (_cp, input, "Materials/"+material+"/SpecificHeat/value", _cp);
75  }
76  // If instead we have the old version, use that.
77  else if( input.have_variable("Materials/SpecificHeat/cp") )
78  {
79  MaterialsParsing::dep_input_warning( "Materials/SpecificHeat/cp",
80  "SpecificHeat/value" );
81 
82  this->set_parameter
83  (_cp, input, "Materials/SpecificHeat/cp", _cp);
84  }
85  else
86  {
87  libmesh_error_msg("ERROR: Could not find valid input for ConstantSpecificHeat! Please set Materials/"+material+"/SpecificHeat/value");
88  }
89  }
90 
92  {
93  return;
94  }
95 
96 } // namespace GRINS
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.
#define grins_warning(message)
Definition: common.h:34
GRINS namespace.
ParameterUser base class. Utility methods for subclasses.
static void dep_input_warning(const std::string &old_option, const std::string &property)
Helper function for parsing/maintaing backward compatibility.
static void duplicate_input_test(const GetPot &input, const std::string &option1, const std::string &option2)
Helper function for parsing/maintaing backward compatibility.

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