GRINS-0.8.0
mooney_rivlin.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
26 #include "grins/mooney_rivlin.h"
27 
28 // GRINS
29 #include "grins/common.h"
31 
32 // libMesh
33 #include "libmesh/getpot.h"
34 
35 namespace GRINS
36 {
37  MooneyRivlin::MooneyRivlin( const GetPot& input )
39  ParameterUser("MooneyRivlin"),
40  _C1(-1),
41  _C2(-1)
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  //Force the user to specify C1 and C2
51  if( !input.have_variable("Physics/MooneyRivlin/C1") ||
52  !input.have_variable("Physics/MooneyRivlin/C2") )
53  {
54  std::cerr << "Error: Must specify both C1 and C2 for Mooney-Rivlin material." << std::endl
55  << " They can be specified in Physics/MooneyRivlin/C1 and Physics/MooneyRivlin/C2" << std::endl;
56  libmesh_error();
57  }
58 
59  this->set_parameter
60  (_C1, input, "Physics/MooneyRivlin/C1", _C1);
61 
62  this->set_parameter
63  (_C2, input, "Physics/MooneyRivlin/C2", _C2);
64  return;
65  }
66 
67  MooneyRivlin::MooneyRivlin( const GetPot& input, const std::string& material )
69  ParameterUser("MooneyRivlin"),
70  _C1(-1),
71  _C2(-1)
72  {
74  "Materials/"+material+"/StressStrainLaw/MooneyRivlin/C1",
75  "Physics/MooneyRivlin/C1");
77  "Materials/"+material+"/StressStrainLaw/MooneyRivlin/C2",
78  "Physics/MooneyRivlin/C2");
79 
80  // Parse the new version
81  if( input.have_variable("Materials/"+material+"/StressStrainLaw/MooneyRivlin/C1") &&
82  input.have_variable("Materials/"+material+"/StressStrainLaw/MooneyRivlin/C2") )
83  {
84  this->set_parameter
85  (_C1, input, "Materials/"+material+"/StressStrainLaw/MooneyRivlin/C1", _C1);
86  this->set_parameter
87  (_C2, input, "Materials/"+material+"/StressStrainLaw/MooneyRivlin/C2", _C2);
88  }
89  // Parse the old version
90  else if( input.have_variable("Physics/MooneyRivlin/C1") &&
91  input.have_variable("Physics/MooneyRivlin/C2") )
92  {
93  MaterialsParsing::dep_input_warning( "Physics/MooneyRivlin/C1",
94  "StressStrainLaw/MooneyRivlin/C1" );
95  MaterialsParsing::dep_input_warning( "Physics/MooneyRivlin/C2",
96  "StressStrainLaw/MooneyRivlin/C2" );
97 
98  this->set_parameter
99  (_C1, input, "Physics/MooneyRivlin/C1", _C1);
100  this->set_parameter
101  (_C2, input, "Physics/MooneyRivlin/C2", _C2);
102  }
103  else
104  {
105  libmesh_error_msg("ERROR: Could not find consistent Mooney-Rivlin input!");
106  }
107  }
108 
110  {
111  return;
112  }
113 
114 } // end 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.
libMesh::Real _C2
Definition: mooney_rivlin.h:59
static void duplicate_input_test(const GetPot &input, const std::string &option1, const std::string &option2)
Helper function for parsing/maintaing backward compatibility.
libMesh::Real _C1
Definition: mooney_rivlin.h:58

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