GRINS-0.6.0
hookes_law_1d.C
Go to the documentation of this file.
1 //-----------------------------------------------------------------------bl-
2 //--------------------------------------------------------------------------
3 //
4 // GRINS - General Reacting Incompressible Navier-Stokes
5 //
6 // Copyright (C) 2014-2015 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/hookes_law_1d.h"
27 
28 // GRINS
30 
31 // libMesh
32 #include "libmesh/getpot.h"
33 #include "libmesh/tensor_value.h"
34 
35 namespace GRINS
36 {
37  HookesLaw1D::HookesLaw1D(const GetPot& input)
39  ParameterUser("HookesLaw1D"),
40  _E(0.0),
41  _nu(0.0)
42  {
43  this->read_input_options(input);
44 
45  return;
46  }
47 
49  {
50  return;
51  }
52 
53  void HookesLaw1D::read_input_options(const GetPot& input)
54  {
55  // We'd better have either Lam\'{e} constants or E and nu
56  if( ( !input.have_variable("Physics/HookesLaw/lambda") ||
57  !input.have_variable("Physics/HookesLaw/mu") ) &&
58  ( !input.have_variable("Physics/HookesLaw/E") ||
59  !input.have_variable("Physics/HookesLaw/nu") ) )
60  {
61  std::cerr << "Error: Must specify either Lame constants lambda and mu or" << std::endl
62  << " Young's modulus and Poisson's ratio." << std::endl;
63  libmesh_error();
64  }
65 
66  if( input.have_variable("Physics/HookesLaw/lambda") &&
67  input.have_variable("Physics/HookesLaw/mu") )
68  {
69  // FIXME - we'll need a special accessor to give parameter
70  // access to these
71  libMesh::Real lambda = input("Physics/HookesLaw/lambda", 0.0);
72  libMesh::Real mu = input("Physics/HookesLaw/mu", 0.0);
73  _E = mu*(3*lambda + 2*mu)/(lambda+mu);
74  _nu = lambda/(2*(lambda+mu));
75  }
76  else
77  {
78  if( input.have_variable("Physics/HookesLaw/E") )
79  this->set_parameter
80  (_E, input, "Physics/HookesLaw/E", 0.0);
81 
82  if( input.have_variable("Physics/HookesLaw/nu") )
83  this->set_parameter
84  (_nu, input, "Physics/HookesLaw/nu", 0.0);
85  }
86  }
87 
88  void HookesLaw1D::compute_stress_imp( unsigned int /*dim*/,
91  const libMesh::TensorValue<libMesh::Real>& /*G_contra*/,
94  {
95  stress.zero();
96 
97  libMesh::Real strain = 0.5*(G_cov(0,0) - g_cov(0,0));
98 
99  stress(0,0) = (this->_E)*g_contra(0,0)*g_contra(0,0)*strain;
100 
101  return;
102  }
103 
105  const libMesh::TensorValue<libMesh::Real>& g_contra,
107  const libMesh::TensorValue<libMesh::Real>& G_contra,
110  ElasticityTensor& C)
111  {
112  this->compute_stress_imp(dim,g_contra,g_cov,G_contra,G_cov,stress);
113 
114  C(0,0,0,0) = this->_E*g_contra(0,0)*g_contra(0,0);
115 
116  return;
117  }
118 
120  const libMesh::TensorValue<libMesh::Real>& /*g_cov*/,
121  const libMesh::TensorValue<libMesh::Real>& /*G_contra*/,
122  const libMesh::TensorValue<libMesh::Real>& /*G_cov*/ )
123  {
124  libmesh_not_implemented();
125 
126  return 0.0;
127  }
128 
129 } // 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.
libMesh::Real _E
Lam\'{e} constant.
Definition: hookes_law_1d.h:82
libMesh::Real _nu
Lam\'{e} constant.
Definition: hookes_law_1d.h:85
GRINS namespace.
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)
Hooke's law specialized for one-dimensional problems.
Definition: hookes_law_1d.h:43
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_1d.C:88
virtual ~HookesLaw1D()
Definition: hookes_law_1d.C:48
ParameterUser base class. Utility methods for subclasses.
void read_input_options(const GetPot &input)
Parse properties from input.
Definition: hookes_law_1d.C:53
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)

Generated on Mon Jun 22 2015 21:32:20 for GRINS-0.6.0 by  doxygen 1.8.9.1