29 #include "libmesh/getpot.h"
30 #include "libmesh/tensor_value.h"
54 if( ( !input.have_variable(
"Physics/HookesLaw/lambda") ||
55 !input.have_variable(
"Physics/HookesLaw/mu") ) &&
56 ( !input.have_variable(
"Physics/HookesLaw/E") ||
57 !input.have_variable(
"Physics/HookesLaw/nu") ) )
59 std::cerr <<
"Error: Must specify either Lame constants lambda and mu or" << std::endl
60 <<
" Young's modulus and Poisson's ratio." << std::endl;
64 if( input.have_variable(
"Physics/HookesLaw/lambda") )
66 (
_lambda, input,
"Physics/HookesLaw/lambda", 0.0);
68 if( input.have_variable(
"Physics/HookesLaw/mu") )
70 (
_mu, input,
"Physics/HookesLaw/mu", 0.0);
72 if( input.have_variable(
"Physics/HookesLaw/E") &&
73 input.have_variable(
"Physics/HookesLaw/nu") )
77 libMesh::Real E = input(
"Physics/HookesLaw/E", 0.0);
78 libMesh::Real nu = input(
"Physics/HookesLaw/nu", 0.0);
79 _lambda = nu*E/( (1+nu)*(1-2*nu) );
95 for(
unsigned int i = 0; i < dim; i++ )
97 for(
unsigned int j = 0; j < dim; j++ )
99 for(
unsigned int k = 0; k < dim; k++ )
101 for(
unsigned int l = 0; l < dim; l++ )
103 libMesh::Real strain_kl = 0.5*(G_cov(k,l) - g_cov(k,l));
105 _C(i,j,k,l) =
_lambda*g_contra(i,j)*g_contra(k,l) +
106 _mu*(g_contra(i,k)*g_contra(j,l) + g_contra(i,l)*g_contra(j,k));
108 stress(i,j) +=
_C(i,j,k,l)*strain_kl;
137 libMesh::Real sigma_33 = 0.0;
139 for(
unsigned int k = 0; k < 3; k++ )
141 for(
unsigned int l = 0; l < 3; l++ )
143 libMesh::Real strain_kl = 0.5*(G_cov(k,l) - g_cov(k,l));
145 libMesh::Real C =
_lambda*g_contra(2,2)*g_contra(k,l) +
146 _mu*(g_contra(2,k)*g_contra(2,l) + g_contra(2,l)*g_contra(2,k));
148 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)
Elasticity tensor for Hooke's law.
ParameterUser base class. Utility methods for subclasses.
libMesh::Real _mu
Lam\'{e} constant.
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)
libMesh::Real _lambda
Lam\'{e} constant.