33 #include "libmesh/getpot.h"
34 #include "libmesh/tensor_value.h"
47 std::string warning =
"WARNING: Use of this constructor is DEPRECATED.\n";
48 warning +=
" Please update to use constructor with input material name.\n";
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");
78 if( input.have_variable(
"Materials/"+material+
"/StressStrainLaw/HookesLaw/lambda") &&
79 input.have_variable(
"Materials/"+material+
"/StressStrainLaw/HookesLaw/mu") )
82 (
_lambda, input,
"Materials/"+material+
"/StressStrainLaw/HookesLaw/lambda", 0.0);
84 (
_mu, input,
"Materials/"+material+
"/StressStrainLaw/HookesLaw/mu", 0.0);
86 else if( input.have_variable(
"Materials/"+material+
"/StressStrainLaw/HookesLaw/E") &&
87 input.have_variable(
"Materials/"+material+
"/StressStrainLaw/HookesLaw/nu") )
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) );
96 else if( input.have_variable(
"Physics/HookesLaw/lambda") &&
97 input.have_variable(
"Physics/HookesLaw/mu") )
100 "StressStrainLaw/HookesLaw/lambda" );
102 "StressStrainLaw/HookesLaw/mu" );
105 (
_lambda, input,
"Physics/HookesLaw/lambda", 0.0);
107 (
_mu, input,
"Physics/HookesLaw/mu", 0.0);
109 else if( input.have_variable(
"Physics/HookesLaw/E") &&
110 input.have_variable(
"Physics/HookesLaw/nu") )
113 "StressStrainLaw/HookesLaw/E" );
115 "StressStrainLaw/HookesLaw/nu" );
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) );
125 libmesh_error_msg(
"ERROR: Could not find consistent HookesLaw input!");
130 libmesh_error_msg(
"ERROR: Detected non-positive shear modulus!");
135 std::string warning =
"WARNING: Detected non-positive Lame parameter";
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") ) )
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;
158 if( input.have_variable(
"Physics/HookesLaw/lambda") )
160 (
_lambda, input,
"Physics/HookesLaw/lambda", 0.0);
162 if( input.have_variable(
"Physics/HookesLaw/mu") )
164 (
_mu, input,
"Physics/HookesLaw/mu", 0.0);
166 if( input.have_variable(
"Physics/HookesLaw/E") &&
167 input.have_variable(
"Physics/HookesLaw/nu") )
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) );
189 for(
unsigned int i = 0; i < dim; i++ )
191 for(
unsigned int j = 0; j < dim; j++ )
193 for(
unsigned int k = 0; k < dim; k++ )
195 for(
unsigned int l = 0; l < dim; l++ )
197 libMesh::Real strain_kl = 0.5*(G_cov(k,l) - g_cov(k,l));
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));
202 stress(i,j) +=
_C(i,j,k,l)*strain_kl;
231 libMesh::Real sigma_33 = 0.0;
233 for(
unsigned int k = 0; k < 3; k++ )
235 for(
unsigned int l = 0; l < 3; l++ )
237 libMesh::Real strain_kl = 0.5*(G_cov(k,l) - g_cov(k,l));
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));
242 sigma_33 += C*strain_kl;
virtual void set_parameter(libMesh::Number ¶m_variable, const GetPot &input, const std::string ¶m_name, libMesh::Number param_default)
Each subclass can simultaneously read a parameter value from.
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 read_input_options(const GetPot &input)
Parse properties from input.
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)
#define grins_warning(message)
Elasticity tensor for Hooke's law.
ParameterUser base class. Utility methods for subclasses.
libMesh::Real _mu
Lam\'{e} constant.
static void dep_input_warning(const std::string &old_option, const std::string &property)
Helper function for parsing/maintaing backward compatibility.
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)
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.