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

Elasticity tensor for Hooke's law. More...

#include <hookes_law.h>

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

Public Member Functions

 HookesLaw (const GetPot &input)
 
 HookesLaw (const GetPot &input, const std::string &material)
 
virtual ~HookesLaw ()
 
- Public Member Functions inherited from GRINS::StressStrainLaw< HookesLaw >
 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

 HookesLaw ()
 
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

ElasticityTensor _C
 
libMesh::Real _lambda
 Lam\'{e} constant. More...
 
libMesh::Real _mu
 Lam\'{e} constant. More...
 

Friends

class StressStrainLaw< HookesLaw >
 

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

Elasticity tensor for Hooke's law.

Uses Lam\'{e} constants, but can parse Young's modulus and Poisson's ratio if desired. By default, is constructed for Cartesian coordinate systems. If working with curvilinear coordinate systems, the user should call the set_deformation method before calling operator().

Definition at line 46 of file hookes_law.h.

Constructor & Destructor Documentation

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

Definition at line 38 of file hookes_law.C.

References grins_warning, and read_input_options().

40  ParameterUser("HookesLaw"),
41  _C(),
42  _lambda(0.0),
43  _mu(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  }
void read_input_options(const GetPot &input)
Parse properties from input.
Definition: hookes_law.C:145
#define grins_warning(message)
Definition: common.h:34
ParameterUser(const std::string &user_name)
libMesh::Real _mu
Lam\'{e} constant.
Definition: hookes_law.h:93
friend class StressStrainLaw< HookesLaw >
Definition: hookes_law.h:58
libMesh::Real _lambda
Lam\'{e} constant.
Definition: hookes_law.h:90
ElasticityTensor _C
Definition: hookes_law.h:87
GRINS::HookesLaw::HookesLaw ( const GetPot &  input,
const std::string &  material 
)
Todo:
we'll need a special accessor to give ParameterUser access to these
Todo:
we'll need a special accessor to give ParameterUser access to these

Definition at line 57 of file hookes_law.C.

References _lambda, _mu, GRINS::MaterialsParsing::dep_input_warning(), GRINS::MaterialsParsing::duplicate_input_test(), grins_warning, and GRINS::ParameterUser::set_parameter().

59  ParameterUser("HookesLaw"),
60  _C(),
61  _lambda(0.0),
62  _mu(0.0)
63  {
65  "Materials/"+material+"/StressStrainLaw/HookesLaw/lambda",
66  "Physics/HookesLaw/lambda");
68  "Materials/"+material+"/StressStrainLaw/HookesLaw/mu",
69  "Physics/HookesLaw/mu");
71  "Materials/"+material+"/StressStrainLaw/HookesLaw/E",
72  "Physics/HookesLaw/E");
74  "Materials/"+material+"/StressStrainLaw/HookesLaw/nu",
75  "Physics/HookesLaw/nu");
76 
77  // Parse the new version
78  if( input.have_variable("Materials/"+material+"/StressStrainLaw/HookesLaw/lambda") &&
79  input.have_variable("Materials/"+material+"/StressStrainLaw/HookesLaw/mu") )
80  {
81  this->set_parameter
82  (_lambda, input, "Materials/"+material+"/StressStrainLaw/HookesLaw/lambda", 0.0);
83  this->set_parameter
84  (_mu, input, "Materials/"+material+"/StressStrainLaw/HookesLaw/mu", 0.0);
85  }
86  else if( input.have_variable("Materials/"+material+"/StressStrainLaw/HookesLaw/E") &&
87  input.have_variable("Materials/"+material+"/StressStrainLaw/HookesLaw/nu") )
88  {
90  libMesh::Real E = input("Materials/"+material+"/StressStrainLaw/HookesLaw/E", 0.0);
91  libMesh::Real nu = input("Materials/"+material+"/StressStrainLaw/HookesLaw/nu", 0.0);
92  _lambda = nu*E/( (1+nu)*(1-2*nu) );
93  _mu = E/(2*(1+nu));
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 
104  this->set_parameter
105  (_lambda, input, "Physics/HookesLaw/lambda", 0.0);
106  this->set_parameter
107  (_mu, input, "Physics/HookesLaw/mu", 0.0);
108  }
109  else if( input.have_variable("Physics/HookesLaw/E") &&
110  input.have_variable("Physics/HookesLaw/nu") )
111  {
112  MaterialsParsing::dep_input_warning( "Physics/HookesLaw/E",
113  "StressStrainLaw/HookesLaw/E" );
114  MaterialsParsing::dep_input_warning( "Physics/HookesLaw/nu",
115  "StressStrainLaw/HookesLaw/nu" );
116 
118  libMesh::Real E = input("Physics/HookesLaw/E", 0.0);
119  libMesh::Real nu = input("Physics/HookesLaw/nu", 0.0);
120  _lambda = nu*E/( (1+nu)*(1-2*nu) );
121  _mu = E/(2*(1+nu));
122  }
123  else
124  {
125  libmesh_error_msg("ERROR: Could not find consistent HookesLaw input!");
126  }
127 
128  // mu should be positive
129  if( _mu <= 0.0 )
130  libmesh_error_msg("ERROR: Detected non-positive shear modulus!");
131 
132  // Technically, lambda can be negative, but it's weird. Let's warn about it.
133  if( _lambda <= 0.0 )
134  {
135  std::string warning = "WARNING: Detected non-positive Lame parameter";
136  grins_warning(warning);
137  }
138  }
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
ParameterUser(const std::string &user_name)
libMesh::Real _mu
Lam\'{e} constant.
Definition: hookes_law.h:93
friend class StressStrainLaw< HookesLaw >
Definition: hookes_law.h:58
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.
libMesh::Real _lambda
Lam\'{e} constant.
Definition: hookes_law.h:90
ElasticityTensor _C
Definition: hookes_law.h:87
GRINS::HookesLaw::~HookesLaw ( )
virtual

Definition at line 140 of file hookes_law.C.

141  {
142  return;
143  }
GRINS::HookesLaw::HookesLaw ( )
private

Member Function Documentation

libMesh::Real GRINS::HookesLaw::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 226 of file hookes_law.C.

References _lambda, and _mu.

230  {
231  libMesh::Real sigma_33 = 0.0;
232 
233  for( unsigned int k = 0; k < 3; k++ )
234  {
235  for( unsigned int l = 0; l < 3; l++ )
236  {
237  libMesh::Real strain_kl = 0.5*(G_cov(k,l) - g_cov(k,l));
238 
239  libMesh::Real C = _lambda*g_contra(2,2)*g_contra(k,l) +
240  _mu*(g_contra(2,k)*g_contra(2,l) + g_contra(2,l)*g_contra(2,k));
241 
242  sigma_33 += C*strain_kl;
243  }
244  }
245 
246  return sigma_33;
247  }
libMesh::Real _mu
Lam\'{e} constant.
Definition: hookes_law.h:93
libMesh::Real _lambda
Lam\'{e} constant.
Definition: hookes_law.h:90
void GRINS::HookesLaw::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 211 of file hookes_law.C.

References _C, and compute_stress_imp().

218  {
219  this->compute_stress_imp(dim,g_contra,g_cov,G_contra,G_cov,stress);
220 
221  C = _C;
222 
223  return;
224  }
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)
Definition: hookes_law.C:180
ElasticityTensor _C
Definition: hookes_law.h:87
void GRINS::HookesLaw::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 180 of file hookes_law.C.

References _C, _lambda, and _mu.

Referenced by compute_stress_and_elasticity_imp().

186  {
187  stress.zero();
188 
189  for( unsigned int i = 0; i < dim; i++ )
190  {
191  for( unsigned int j = 0; j < dim; j++ )
192  {
193  for( unsigned int k = 0; k < dim; k++ )
194  {
195  for( unsigned int l = 0; l < dim; l++ )
196  {
197  libMesh::Real strain_kl = 0.5*(G_cov(k,l) - g_cov(k,l));
198 
199  _C(i,j,k,l) = _lambda*g_contra(i,j)*g_contra(k,l) +
200  _mu*(g_contra(i,k)*g_contra(j,l) + g_contra(i,l)*g_contra(j,k));
201 
202  stress(i,j) += _C(i,j,k,l)*strain_kl;
203  }
204  }
205  }
206  }
207 
208  return;
209  }
libMesh::Real _mu
Lam\'{e} constant.
Definition: hookes_law.h:93
libMesh::Real _lambda
Lam\'{e} constant.
Definition: hookes_law.h:90
ElasticityTensor _C
Definition: hookes_law.h:87
void GRINS::HookesLaw::read_input_options ( const GetPot &  input)
private

Parse properties from input.

Definition at line 145 of file hookes_law.C.

References _lambda, _mu, and GRINS::ParameterUser::set_parameter().

Referenced by HookesLaw().

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

Friends And Related Function Documentation

friend class StressStrainLaw< HookesLaw >
friend

Definition at line 58 of file hookes_law.h.

Member Data Documentation

ElasticityTensor GRINS::HookesLaw::_C
private

Definition at line 87 of file hookes_law.h.

Referenced by compute_stress_and_elasticity_imp(), and compute_stress_imp().

libMesh::Real GRINS::HookesLaw::_lambda
private

Lam\'{e} constant.

Definition at line 90 of file hookes_law.h.

Referenced by compute_33_stress_imp(), compute_stress_imp(), HookesLaw(), and read_input_options().

libMesh::Real GRINS::HookesLaw::_mu
private

Lam\'{e} constant.

Definition at line 93 of file hookes_law.h.

Referenced by compute_33_stress_imp(), compute_stress_imp(), HookesLaw(), 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