GRINS-0.8.0
List of all members | Public Member Functions | Private Member Functions | Private Attributes | Friends
GRINS::HookesLaw1D Class Reference

Hooke's law specialized for one-dimensional problems. More...

#include <hookes_law_1d.h>

Inheritance diagram for GRINS::HookesLaw1D:
Inheritance graph
[legend]
Collaboration diagram for GRINS::HookesLaw1D:
Collaboration graph
[legend]

Public Member Functions

 HookesLaw1D (const GetPot &input)
 
 HookesLaw1D (const GetPot &input, const std::string &material)
 
virtual ~HookesLaw1D ()
 
- Public Member Functions inherited from GRINS::StressStrainLaw< HookesLaw1D >
 StressStrainLaw ()
 
virtual ~StressStrainLaw ()
 
void compute_stress (unsigned int dim, const libMesh::TensorValue< libMesh::Real > &g_contra, const libMesh::TensorValue< libMesh::Real > &g_cov, const libMesh::TensorValue< libMesh::Real > &G_contra, const libMesh::TensorValue< libMesh::Real > &G_cov, libMesh::TensorValue< libMesh::Real > &stress)
 
void compute_stress_and_elasticity (unsigned int dim, const libMesh::TensorValue< libMesh::Real > &g_contra, const libMesh::TensorValue< libMesh::Real > &g_cov, const libMesh::TensorValue< libMesh::Real > &G_contra, const libMesh::TensorValue< libMesh::Real > &G_cov, libMesh::TensorValue< libMesh::Real > &stress, ElasticityTensor &C)
 
libMesh::Real compute_33_stress (const libMesh::TensorValue< libMesh::Real > &g_contra, const libMesh::TensorValue< libMesh::Real > &g_cov, const libMesh::TensorValue< libMesh::Real > &G_contra, const libMesh::TensorValue< libMesh::Real > &G_cov)
 This is primarily a helper function for the plane stress cases. More...
 
- Public Member Functions inherited from GRINS::ParameterUser
 ParameterUser (const std::string &user_name)
 
virtual ~ParameterUser ()
 
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. More...
 
virtual void set_parameter (libMesh::ParsedFunction< libMesh::Number, libMesh::Gradient > &func, const GetPot &input, const std::string &func_param_name, const std::string &param_default)
 Each subclass can simultaneously read a parsed function from. More...
 
virtual void set_parameter (libMesh::ParsedFEMFunction< libMesh::Number > &func, const GetPot &input, const std::string &func_param_name, const std::string &param_default)
 Each subclass can simultaneously read a parsed function from. More...
 
virtual void move_parameter (const libMesh::Number &old_parameter, libMesh::Number &new_parameter)
 When cloning an object, we need to update parameter pointers. More...
 
virtual void move_parameter (const libMesh::ParsedFunction< libMesh::Number, libMesh::Gradient > &old_func, libMesh::ParsedFunction< libMesh::Number, libMesh::Gradient > &new_func)
 When cloning an object, we need to update parameter pointers. More...
 
virtual void move_parameter (const libMesh::ParsedFEMFunction< libMesh::Number > &old_func, libMesh::ParsedFEMFunction< libMesh::Number > &new_func)
 When cloning an object, we need to update parameter pointers. More...
 
virtual void register_parameter (const std::string &param_name, libMesh::ParameterMultiAccessor< libMesh::Number > &param_pointer) const
 Each subclass will register its copy of an independent. More...
 

Private Member Functions

 HookesLaw1D ()
 
void read_input_options (const GetPot &input)
 Parse properties from input. More...
 
void compute_stress_imp (unsigned int dim, const libMesh::TensorValue< libMesh::Real > &g_contra, const libMesh::TensorValue< libMesh::Real > &g_cov, const libMesh::TensorValue< libMesh::Real > &G_contra, const libMesh::TensorValue< libMesh::Real > &G_cov, libMesh::TensorValue< libMesh::Real > &stress)
 
void compute_stress_and_elasticity_imp (unsigned int dim, const libMesh::TensorValue< libMesh::Real > &g_contra, const libMesh::TensorValue< libMesh::Real > &g_cov, const libMesh::TensorValue< libMesh::Real > &G_contra, const libMesh::TensorValue< libMesh::Real > &G_cov, libMesh::TensorValue< libMesh::Real > &stress, ElasticityTensor &C)
 
libMesh::Real compute_33_stress_imp (const libMesh::TensorValue< libMesh::Real > &g_contra, const libMesh::TensorValue< libMesh::Real > &g_cov, const libMesh::TensorValue< libMesh::Real > &G_contra, const libMesh::TensorValue< libMesh::Real > &G_cov)
 

Private Attributes

libMesh::Real _E
 Lam\'{e} constant. More...
 
libMesh::Real _nu
 Lam\'{e} constant. More...
 

Friends

class StressStrainLaw< HookesLaw1D >
 

Additional Inherited Members

- Static Public Attributes inherited from GRINS::ParameterUser
static std::string zero_vector_function = std::string("{0}")
 A parseable function string with LIBMESH_DIM components, all 0. More...
 

Detailed Description

Hooke's law specialized for one-dimensional problems.

General form is not conducive to one-dimensional problems so this should be used in those cases.

Definition at line 43 of file hookes_law_1d.h.

Constructor & Destructor Documentation

GRINS::HookesLaw1D::HookesLaw1D ( const GetPot &  input)

Definition at line 39 of file hookes_law_1d.C.

References grins_warning, and read_input_options().

41  ParameterUser("HookesLaw1D"),
42  _E(0.0),
43  _nu(0.0)
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->read_input_options(input);
53 
54  return;
55  }
libMesh::Real _E
Lam\'{e} constant.
Definition: hookes_law_1d.h:85
libMesh::Real _nu
Lam\'{e} constant.
Definition: hookes_law_1d.h:88
#define grins_warning(message)
Definition: common.h:34
ParameterUser(const std::string &user_name)
friend class StressStrainLaw< HookesLaw1D >
Definition: hookes_law_1d.h:55
void read_input_options(const GetPot &input)
Parse properties from input.
GRINS::HookesLaw1D::HookesLaw1D ( const GetPot &  input,
const std::string &  material 
)
Todo:
we'll need a special accessor to give ParameterUser access to these

Definition at line 57 of file hookes_law_1d.C.

References _E, _nu, GRINS::MaterialsParsing::dep_input_warning(), GRINS::MaterialsParsing::duplicate_input_test(), grins_warning, and GRINS::ParameterUser::set_parameter().

59  ParameterUser("HookesLaw1D"),
60  _E(0.0),
61  _nu(0.0)
62  {
64  "Materials/"+material+"/StressStrainLaw/HookesLaw/lambda",
65  "Physics/HookesLaw/lambda");
67  "Materials/"+material+"/StressStrainLaw/HookesLaw/mu",
68  "Physics/HookesLaw/mu");
70  "Materials/"+material+"/StressStrainLaw/HookesLaw/E",
71  "Physics/HookesLaw/E");
73  "Materials/"+material+"/StressStrainLaw/HookesLaw/nu",
74  "Physics/HookesLaw/nu");
75 
76  // Parse the new version
77  if( input.have_variable("Materials/"+material+"/StressStrainLaw/HookesLaw/lambda") &&
78  input.have_variable("Materials/"+material+"/StressStrainLaw/HookesLaw/mu") )
79  {
80  // FIXME - we'll need a special accessor to give parameter
81  // access to these
82  libMesh::Real lambda = input("Physics/HookesLaw/lambda", 0.0);
83  libMesh::Real mu = input("Physics/HookesLaw/mu", 0.0);
84  _E = mu*(3*lambda + 2*mu)/(lambda+mu);
85  _nu = lambda/(2*(lambda+mu));
86  }
87  else if( input.have_variable("Materials/"+material+"/StressStrainLaw/HookesLaw/E") &&
88  input.have_variable("Materials/"+material+"/StressStrainLaw/HookesLaw/nu") )
89  {
90  this->set_parameter
91  (_E, input, "Materials/"+material+"/StressStrainLaw/HookesLaw/E", 0.0);
92  this->set_parameter
93  (_nu, input, "Materials/"+material+"/StressStrainLaw/HookesLaw/nu", 0.0);
94  }
95  // Parse the old version
96  else if( input.have_variable("Physics/HookesLaw/lambda") &&
97  input.have_variable("Physics/HookesLaw/mu") )
98  {
99  MaterialsParsing::dep_input_warning( "Physics/HookesLaw/lambda",
100  "StressStrainLaw/HookesLaw/lambda" );
101  MaterialsParsing::dep_input_warning( "Physics/HookesLaw/mu",
102  "StressStrainLaw/HookesLaw/mu" );
103 
105  libMesh::Real lambda = input("Physics/HookesLaw/lambda", 0.0);
106  libMesh::Real mu = input("Physics/HookesLaw/mu", 0.0);
107  _E = mu*(3*lambda + 2*mu)/(lambda+mu);
108  _nu = lambda/(2*(lambda+mu));
109  }
110  else if( input.have_variable("Physics/HookesLaw/E") &&
111  input.have_variable("Physics/HookesLaw/nu") )
112  {
113  MaterialsParsing::dep_input_warning( "Physics/HookesLaw/E",
114  "StressStrainLaw/HookesLaw/E" );
115  MaterialsParsing::dep_input_warning( "Physics/HookesLaw/nu",
116  "StressStrainLaw/HookesLaw/nu" );
117 
118  this->set_parameter(_E, input, "Physics/HookesLaw/E", 0.0);
119  this->set_parameter(_nu, input, "Physics/HookesLaw/nu", 0.0);
120  }
121  else
122  {
123  libmesh_error_msg("ERROR: Could not find consistent HookesLaw input!");
124  }
125 
126  // mu should be positive
127  if( _E <= 0.0 )
128  libmesh_error_msg("ERROR: Detected non-positive Young's modulus!");
129 
130  // Technically, Poisson's ratio can be negative, but it's weird. Let's warn about it.
131  if( _nu < 0.0 )
132  {
133  std::string warning = "WARNING: Detected non-positive Poisson's ratio";
134  grins_warning(warning);
135  }
136  }
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.
libMesh::Real _E
Lam\'{e} constant.
Definition: hookes_law_1d.h:85
libMesh::Real _nu
Lam\'{e} constant.
Definition: hookes_law_1d.h:88
#define grins_warning(message)
Definition: common.h:34
ParameterUser(const std::string &user_name)
friend class StressStrainLaw< HookesLaw1D >
Definition: hookes_law_1d.h:55
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.
GRINS::HookesLaw1D::~HookesLaw1D ( )
virtual

Definition at line 138 of file hookes_law_1d.C.

139  {
140  return;
141  }
GRINS::HookesLaw1D::HookesLaw1D ( )
private

Member Function Documentation

libMesh::Real GRINS::HookesLaw1D::compute_33_stress_imp ( const libMesh::TensorValue< libMesh::Real > &  g_contra,
const libMesh::TensorValue< libMesh::Real > &  g_cov,
const libMesh::TensorValue< libMesh::Real > &  G_contra,
const libMesh::TensorValue< libMesh::Real > &  G_cov 
)
private

Definition at line 209 of file hookes_law_1d.C.

213  {
214  libmesh_not_implemented();
215 
216  return 0.0;
217  }
void GRINS::HookesLaw1D::compute_stress_and_elasticity_imp ( unsigned int  dim,
const libMesh::TensorValue< libMesh::Real > &  g_contra,
const libMesh::TensorValue< libMesh::Real > &  g_cov,
const libMesh::TensorValue< libMesh::Real > &  G_contra,
const libMesh::TensorValue< libMesh::Real > &  G_cov,
libMesh::TensorValue< libMesh::Real > &  stress,
ElasticityTensor C 
)
private

Definition at line 194 of file hookes_law_1d.C.

References _E, and compute_stress_imp().

201  {
202  this->compute_stress_imp(dim,g_contra,g_cov,G_contra,G_cov,stress);
203 
204  C(0,0,0,0) = this->_E*g_contra(0,0)*g_contra(0,0);
205 
206  return;
207  }
libMesh::Real _E
Lam\'{e} constant.
Definition: hookes_law_1d.h:85
void compute_stress_imp(unsigned int dim, const libMesh::TensorValue< libMesh::Real > &g_contra, const libMesh::TensorValue< libMesh::Real > &g_cov, const libMesh::TensorValue< libMesh::Real > &G_contra, const libMesh::TensorValue< libMesh::Real > &G_cov, libMesh::TensorValue< libMesh::Real > &stress)
void GRINS::HookesLaw1D::compute_stress_imp ( unsigned int  dim,
const libMesh::TensorValue< libMesh::Real > &  g_contra,
const libMesh::TensorValue< libMesh::Real > &  g_cov,
const libMesh::TensorValue< libMesh::Real > &  G_contra,
const libMesh::TensorValue< libMesh::Real > &  G_cov,
libMesh::TensorValue< libMesh::Real > &  stress 
)
private

Definition at line 178 of file hookes_law_1d.C.

References _E.

Referenced by compute_stress_and_elasticity_imp().

184  {
185  stress.zero();
186 
187  libMesh::Real strain = 0.5*(G_cov(0,0) - g_cov(0,0));
188 
189  stress(0,0) = (this->_E)*g_contra(0,0)*g_contra(0,0)*strain;
190 
191  return;
192  }
libMesh::Real _E
Lam\'{e} constant.
Definition: hookes_law_1d.h:85
void GRINS::HookesLaw1D::read_input_options ( const GetPot &  input)
private

Parse properties from input.

Definition at line 143 of file hookes_law_1d.C.

References _E, _nu, and GRINS::ParameterUser::set_parameter().

Referenced by HookesLaw1D().

144  {
145  // We'd better have either Lam\'{e} constants or E and nu
146  if( ( !input.have_variable("Physics/HookesLaw/lambda") ||
147  !input.have_variable("Physics/HookesLaw/mu") ) &&
148  ( !input.have_variable("Physics/HookesLaw/E") ||
149  !input.have_variable("Physics/HookesLaw/nu") ) )
150  {
151  std::cerr << "Error: Must specify either Lame constants lambda and mu or" << std::endl
152  << " Young's modulus and Poisson's ratio." << std::endl;
153  libmesh_error();
154  }
155 
156  if( input.have_variable("Physics/HookesLaw/lambda") &&
157  input.have_variable("Physics/HookesLaw/mu") )
158  {
159  // FIXME - we'll need a special accessor to give parameter
160  // access to these
161  libMesh::Real lambda = input("Physics/HookesLaw/lambda", 0.0);
162  libMesh::Real mu = input("Physics/HookesLaw/mu", 0.0);
163  _E = mu*(3*lambda + 2*mu)/(lambda+mu);
164  _nu = lambda/(2*(lambda+mu));
165  }
166  else
167  {
168  if( input.have_variable("Physics/HookesLaw/E") )
169  this->set_parameter
170  (_E, input, "Physics/HookesLaw/E", 0.0);
171 
172  if( input.have_variable("Physics/HookesLaw/nu") )
173  this->set_parameter
174  (_nu, input, "Physics/HookesLaw/nu", 0.0);
175  }
176  }
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.
libMesh::Real _E
Lam\'{e} constant.
Definition: hookes_law_1d.h:85
libMesh::Real _nu
Lam\'{e} constant.
Definition: hookes_law_1d.h:88

Friends And Related Function Documentation

friend class StressStrainLaw< HookesLaw1D >
friend

Definition at line 55 of file hookes_law_1d.h.

Member Data Documentation

libMesh::Real GRINS::HookesLaw1D::_E
private

Lam\'{e} constant.

Definition at line 85 of file hookes_law_1d.h.

Referenced by compute_stress_and_elasticity_imp(), compute_stress_imp(), HookesLaw1D(), and read_input_options().

libMesh::Real GRINS::HookesLaw1D::_nu
private

Lam\'{e} constant.

Definition at line 88 of file hookes_law_1d.h.

Referenced by HookesLaw1D(), and read_input_options().


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

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