GRINS-0.7.0
List of all members | Public Member Functions | Private Member Functions | Private Attributes
GRINS::ElasticMembrane< StressStrainLaw > Class Template Reference

#include <elastic_membrane.h>

Inheritance diagram for GRINS::ElasticMembrane< StressStrainLaw >:
Inheritance graph
[legend]
Collaboration diagram for GRINS::ElasticMembrane< StressStrainLaw >:
Collaboration graph
[legend]

Public Member Functions

 ElasticMembrane (const GRINS::PhysicsName &physics_name, const GetPot &input, bool is_compressible)
 
virtual ~ElasticMembrane ()
 
virtual void register_postprocessing_vars (const GetPot &input, PostProcessedQuantities< libMesh::Real > &postprocessing)
 Register postprocessing variables for ElasticMembrane. More...
 
virtual void element_time_derivative (bool compute_jacobian, AssemblyContext &context, CachedValues &)
 Time dependent part(s) of physics for element interiors. More...
 
virtual void element_constraint (bool compute_jacobian, AssemblyContext &context, CachedValues &cache)
 Constraint part(s) of physics for element interiors. More...
 
virtual void mass_residual (bool compute_jacobian, AssemblyContext &context, CachedValues &)
 Mass matrix part(s) for element interiors. All boundary terms lie within the time_derivative part. More...
 
virtual void compute_postprocessed_quantity (unsigned int quantity_index, const AssemblyContext &context, const libMesh::Point &point, libMesh::Real &value)
 Compute the registered postprocessed quantities. More...
 
- Public Member Functions inherited from GRINS::ElasticMembraneBase< StressStrainLaw >
 ElasticMembraneBase (const GRINS::PhysicsName &physics_name, const GetPot &input, bool is_compressible)
 
virtual ~ElasticMembraneBase ()
 
virtual void init_variables (libMesh::FEMSystem *system)
 Initialize variables for this physics. More...
 
- Public Member Functions inherited from GRINS::ElasticMembraneAbstract
 ElasticMembraneAbstract (const GRINS::PhysicsName &physics_name, const GetPot &input)
 
virtual ~ElasticMembraneAbstract ()
 
virtual void init_context (AssemblyContext &context)
 Initialize context for added physics variables. More...
 
- Public Member Functions inherited from GRINS::SolidMechanicsAbstract
 SolidMechanicsAbstract (const GRINS::PhysicsName &physics_name, const GetPot &input)
 
virtual ~SolidMechanicsAbstract ()
 
virtual void set_time_evolving_vars (libMesh::FEMSystem *system)
 Set which variables are time evolving. More...
 
- Public Member Functions inherited from GRINS::Physics
 Physics (const GRINS::PhysicsName &physics_name, const GetPot &input)
 
virtual ~Physics ()
 
virtual bool enabled_on_elem (const libMesh::Elem *elem)
 Find if current physics is active on supplied element. More...
 
void set_is_steady (bool is_steady)
 Sets whether this physics is to be solved with a steady solver or not. More...
 
bool is_steady () const
 Returns whether or not this physics is being solved with a steady solver. More...
 
virtual void auxiliary_init (MultiphysicsSystem &system)
 Any auxillary initialization a Physics class may need. More...
 
virtual void side_time_derivative (bool compute_jacobian, AssemblyContext &context, CachedValues &cache)
 Time dependent part(s) of physics for boundaries of elements on the domain boundary. More...
 
virtual void nonlocal_time_derivative (bool compute_jacobian, AssemblyContext &context, CachedValues &cache)
 Time dependent part(s) of physics for scalar variables. More...
 
virtual void side_constraint (bool compute_jacobian, AssemblyContext &context, CachedValues &cache)
 Constraint part(s) of physics for boundaries of elements on the domain boundary. More...
 
virtual void nonlocal_constraint (bool compute_jacobian, AssemblyContext &context, CachedValues &cache)
 Constraint part(s) of physics for scalar variables. More...
 
virtual void damping_residual (bool compute_jacobian, AssemblyContext &context, CachedValues &cache)
 Damping matrix part(s) for element interiors. All boundary terms lie within the time_derivative part. More...
 
virtual void nonlocal_mass_residual (bool compute_jacobian, AssemblyContext &context, CachedValues &cache)
 Mass matrix part(s) for scalar variables. More...
 
void init_ics (libMesh::FEMSystem *system, libMesh::CompositeFunction< libMesh::Number > &all_ics)
 
virtual void compute_element_time_derivative_cache (const AssemblyContext &context, CachedValues &cache)
 
virtual void compute_side_time_derivative_cache (const AssemblyContext &context, CachedValues &cache)
 
virtual void compute_nonlocal_time_derivative_cache (const AssemblyContext &context, CachedValues &cache)
 
virtual void compute_element_constraint_cache (const AssemblyContext &context, CachedValues &cache)
 
virtual void compute_side_constraint_cache (const AssemblyContext &context, CachedValues &cache)
 
virtual void compute_nonlocal_constraint_cache (const AssemblyContext &context, CachedValues &cache)
 
virtual void compute_damping_residual_cache (const AssemblyContext &context, CachedValues &cache)
 
virtual void compute_mass_residual_cache (const AssemblyContext &context, CachedValues &cache)
 
virtual void compute_nonlocal_mass_residual_cache (const AssemblyContext &context, CachedValues &cache)
 
ICHandlingBaseget_ic_handler ()
 
- 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

 ElasticMembrane ()
 

Private Attributes

std::vector< unsigned int > _stress_indices
 Index from registering this quantity for postprocessing. Each component will have it's own index. More...
 
unsigned int _stress_zz_index
 Index from registering sigma_zz for postprocessing. Mainly for sanity checking. More...
 
std::vector< unsigned int > _strain_indices
 Index from registering this quantity for postprocessing. Each component will have it's own index. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from GRINS::Physics
static void set_is_axisymmetric (bool is_axisymmetric)
 Set whether we should treat the problem as axisymmetric. More...
 
static bool is_axisymmetric ()
 
- 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...
 
- Protected Types inherited from GRINS::SolidMechanicsAbstract
typedef const libMesh::DenseSubVector< libMesh::Number > &(libMesh::DiffContext::* VarFuncType) (unsigned int) const
 
typedef void(libMesh::FEMContext::* InteriorFuncType) (unsigned int, unsigned int, libMesh::Real &) const
 
typedef libMesh::Real(libMesh::DiffContext::* VarDerivType) () const
 
- Protected Member Functions inherited from GRINS::ElasticMembraneBase< StressStrainLaw >
void mass_residual_impl (bool compute_jacobian, AssemblyContext &context, InteriorFuncType interior_solution, VarDerivType get_solution_deriv, libMesh::Real mu=1.0)
 Implementation of mass_residual. More...
 
void compute_metric_tensors (unsigned int qp, const libMesh::FEBase &elem, const AssemblyContext &context, const libMesh::Gradient &grad_u, const libMesh::Gradient &grad_v, const libMesh::Gradient &grad_w, libMesh::TensorValue< libMesh::Real > &a_cov, libMesh::TensorValue< libMesh::Real > &a_contra, libMesh::TensorValue< libMesh::Real > &A_cov, libMesh::TensorValue< libMesh::Real > &A_contra, libMesh::Real &lambda_sq)
 
- Protected Member Functions inherited from GRINS::ElasticMembraneAbstract
const libMesh::FEGenericBase< libMesh::Real > * get_fe (const AssemblyContext &context)
 
- Protected Member Functions inherited from GRINS::Physics
libMesh::UniquePtr< libMesh::FEGenericBase< libMesh::Real > > build_new_fe (const libMesh::Elem *elem, const libMesh::FEGenericBase< libMesh::Real > *fe, const libMesh::Point p)
 
void parse_enabled_subdomains (const GetPot &input, const std::string &physics_name)
 
- Protected Attributes inherited from GRINS::ElasticMembraneBase< StressStrainLaw >
StressStrainLaw _stress_strain_law
 
bool _is_compressible
 
libMesh::Real _h0
 Membrane thickness. More...
 
libMesh::Real _rho
 Membrane density. More...
 
VariableIndex _lambda_sq_var
 Variable index for lambda_sq variable. More...
 
- Protected Attributes inherited from GRINS::SolidMechanicsAbstract
DisplacementFEVariables _disp_vars
 
- Protected Attributes inherited from GRINS::Physics
const PhysicsName _physics_name
 Name of the physics object. Used for reading physics specific inputs. More...
 
GRINS::ICHandlingBase_ic_handler
 
std::set< libMesh::subdomain_id_type > _enabled_subdomains
 Subdomains on which the current Physics class is enabled. More...
 
- Static Protected Attributes inherited from GRINS::Physics
static bool _is_steady = false
 Caches whether or not the solver that's being used is steady or not. More...
 
static bool _is_axisymmetric = false
 Caches whether we are solving an axisymmetric problem or not. More...
 

Detailed Description

template<typename StressStrainLaw>
class GRINS::ElasticMembrane< StressStrainLaw >

Definition at line 34 of file elastic_membrane.h.

Constructor & Destructor Documentation

template<typename StressStrainLaw >
GRINS::ElasticMembrane< StressStrainLaw >::ElasticMembrane ( const GRINS::PhysicsName physics_name,
const GetPot &  input,
bool  is_compressible 
)

Definition at line 46 of file elastic_membrane.C.

References GRINS::Physics::_ic_handler.

48  : ElasticMembraneBase<StressStrainLaw>(physics_name,input,is_compressible)
49  {
50  this->_ic_handler = new GenericICHandler(physics_name, input);
51  }
GRINS::ICHandlingBase * _ic_handler
Definition: physics.h:269
template<typename StressStrainLaw >
virtual GRINS::ElasticMembrane< StressStrainLaw >::~ElasticMembrane ( )
inlinevirtual

Definition at line 41 of file elastic_membrane.h.

41 {};
template<typename StressStrainLaw >
GRINS::ElasticMembrane< StressStrainLaw >::ElasticMembrane ( )
private

Member Function Documentation

template<typename StressStrainLaw >
void GRINS::ElasticMembrane< StressStrainLaw >::compute_postprocessed_quantity ( unsigned int  quantity_index,
const AssemblyContext context,
const libMesh::Point &  point,
libMesh::Real &  value 
)
virtual

Compute the registered postprocessed quantities.

Reimplemented from GRINS::Physics.

Definition at line 359 of file elastic_membrane.C.

References GRINS::Constants::two_pi.

363  {
364  bool is_stress = false;
365  if( !_stress_indices.empty() )
366  is_stress= ( _stress_indices[0] == quantity_index ||
367  _stress_indices[1] == quantity_index ||
368  _stress_indices[2] == quantity_index ||
369  _stress_indices[3] == quantity_index ||
370  _stress_indices[4] == quantity_index ||
371  _stress_indices[5] == quantity_index ||
372  _stress_indices[6] == quantity_index ||
373  _stress_zz_index == quantity_index );
374 
375  bool is_strain = false;
376  if( !_strain_indices.empty() )
377  is_strain = ( _strain_indices[0] == quantity_index ||
378  _strain_indices[1] == quantity_index ||
379  _strain_indices[2] == quantity_index );
380 
381  if( is_stress || is_strain )
382  {
383  const unsigned int n_u_dofs = context.get_dof_indices(this->_disp_vars.u()).size();
384 
385  const libMesh::DenseSubVector<libMesh::Number>& u_coeffs = context.get_elem_solution( this->_disp_vars.u() );
386  const libMesh::DenseSubVector<libMesh::Number>& v_coeffs = context.get_elem_solution( this->_disp_vars.v() );
387  const libMesh::DenseSubVector<libMesh::Number>& w_coeffs = context.get_elem_solution( this->_disp_vars.w() );
388 
389  // Build new FE for the current point. We need this to build tensors at point.
390  libMesh::UniquePtr<libMesh::FEGenericBase<libMesh::Real> > fe_new =
391  this->build_new_fe( &context.get_elem(), this->get_fe(context),
392  point );
393 
394  const std::vector<std::vector<libMesh::Real> >& dphi_dxi =
395  fe_new->get_dphidxi();
396 
397  const std::vector<std::vector<libMesh::Real> >& dphi_deta =
398  fe_new->get_dphideta();
399 
400  // Need these to build up the covariant and contravariant metric tensors
401  const std::vector<libMesh::RealGradient>& dxdxi = fe_new->get_dxyzdxi();
402  const std::vector<libMesh::RealGradient>& dxdeta = fe_new->get_dxyzdeta();
403 
404  // Gradients are w.r.t. master element coordinates
405  libMesh::Gradient grad_u, grad_v, grad_w;
406  for( unsigned int d = 0; d < n_u_dofs; d++ )
407  {
408  libMesh::RealGradient u_gradphi( dphi_dxi[d][0], dphi_deta[d][0] );
409  grad_u += u_coeffs(d)*u_gradphi;
410  grad_v += v_coeffs(d)*u_gradphi;
411  grad_w += w_coeffs(d)*u_gradphi;
412  }
413 
414  libMesh::RealGradient grad_x( dxdxi[0](0), dxdeta[0](0) );
415  libMesh::RealGradient grad_y( dxdxi[0](1), dxdeta[0](1) );
416  libMesh::RealGradient grad_z( dxdxi[0](2), dxdeta[0](2) );
417 
418  libMesh::TensorValue<libMesh::Real> a_cov, a_contra, A_cov, A_contra;
419  libMesh::Real lambda_sq = 0;
420 
421  // We're only computing one point at a time, so qp = 0 always
422  this->compute_metric_tensors(0, *fe_new, context, grad_u, grad_v, grad_w,
423  a_cov, a_contra, A_cov, A_contra, lambda_sq );
424 
425  // We have everything we need for strain now, so check if we are computing strain
426  if( is_strain )
427  {
428  if( _strain_indices[0] == quantity_index )
429  {
430  value = 0.5*(A_cov(0,0) - a_cov(0,0));
431  }
432  else if( _strain_indices[1] == quantity_index )
433  {
434  value = 0.5*(A_cov(0,1) - a_cov(0,1));
435  }
436  else if( _strain_indices[2] == quantity_index )
437  {
438  value = 0.5*(A_cov(1,1) - a_cov(1,1));
439  }
440  else
441  {
442  //Wat?!
443  libmesh_error();
444  }
445  return;
446  }
447 
448  if( is_stress )
449  {
450  libMesh::Real det_a = a_cov(0,0)*a_cov(1,1) - a_cov(0,1)*a_cov(1,0);
451  libMesh::Real det_A = A_cov(0,0)*A_cov(1,1) - A_cov(0,1)*A_cov(1,0);
452 
453  libMesh::Real I3 = lambda_sq*det_A/det_a;
454 
456  this->_stress_strain_law.compute_stress(2,a_contra,a_cov,A_contra,A_cov,tau);
457 
458  if( _stress_indices[0] == quantity_index )
459  {
460  // Need to convert to Cauchy stress
461  value = tau(0,0)/std::sqrt(I3);
462  }
463  else if( _stress_indices[1] == quantity_index )
464  {
465  // Need to convert to Cauchy stress
466  value = tau(0,1)/std::sqrt(I3);
467  }
468  else if( _stress_indices[2] == quantity_index )
469  {
470  // Need to convert to Cauchy stress
471  value = tau(1,1)/std::sqrt(I3);
472  }
473  else if( _stress_indices[3] == quantity_index )
474  {
475  value = 0.5*(tau(0,0) + tau(1,1)) + std::sqrt(0.25*(tau(0,0)-tau(1,1))*(tau(0,0)-tau(1,1))
476  + tau(0,1)*tau(0,1) );
477  }
478  else if( _stress_indices[4] == quantity_index ||
479  _stress_indices[5] == quantity_index ||
480  _stress_indices[6] == quantity_index )
481  {
482  if(this->_is_compressible)
483  {
484  tau(2,2) = this->_stress_strain_law.compute_33_stress( a_contra, a_cov, A_contra, A_cov );
485  }
486 
487  libMesh::Real stress_I1 = tau(0,0) + tau(1,1) + tau(2,2);
488  libMesh::Real stress_I2 = 0.5*(stress_I1*stress_I1 - (tau(0,0)*tau(0,0) + tau(1,1)*tau(1,1)
489  + tau(2,2)*tau(2,2) + tau(0,1)*tau(0,1)
490  + tau(1,0)*tau(1,0)) );
491 
492  libMesh::Real stress_I3 = tau(2,2)*( tau(0,0)*tau(1,1) - tau(1,0)*tau(0,1) );
493 
494  /* Formulae for principal stresses from:
495  http://en.wikiversity.org/wiki/Principal_stresses */
496 
497  // I_2^2 - 3*I_2
498  libMesh::Real C1 = (stress_I1*stress_I1 - 3*stress_I2);
499 
500  // 2*I_1^3 - 9*I_1*_I2 + 27*I_3
501  libMesh::Real C2 = (2*stress_I1*stress_I1*stress_I1 - 9*stress_I1*stress_I2 + 27*stress_I3)/54;
502 
503  libMesh::Real theta = std::acos( C2/(2*std::sqrt(C1*C1*C1)) )/3.0;
504 
505  if( _stress_indices[4] == quantity_index )
506  {
507  value = (stress_I1 + 2.0*std::sqrt(C1)*std::cos(theta))/3.0;
508  }
509 
510  if( _stress_indices[5] == quantity_index )
511  {
512  value = (stress_I1 + 2.0*std::sqrt(C1)*std::cos(theta+Constants::two_pi/3.0))/3.0;
513  }
514 
515  if( _stress_indices[6] == quantity_index )
516  {
517  value = (stress_I1 + 2.0*std::sqrt(C1)*std::cos(theta+2.0*Constants::two_pi/3.0))/3.0;
518  }
519  }
520  else if( _stress_zz_index == quantity_index )
521  {
522  value = this->_stress_strain_law.compute_33_stress( a_contra, a_cov, A_contra, A_cov );
523  }
524  else
525  {
526  //Wat?!
527  libmesh_error();
528  }
529  } // is_stress
530 
531  }
532  }
unsigned int _stress_zz_index
Index from registering sigma_zz for postprocessing. Mainly for sanity checking.
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)
libMesh::UniquePtr< libMesh::FEGenericBase< libMesh::Real > > build_new_fe(const libMesh::Elem *elem, const libMesh::FEGenericBase< libMesh::Real > *fe, const libMesh::Point p)
Definition: physics.C:259
void compute_metric_tensors(unsigned int qp, const libMesh::FEBase &elem, const AssemblyContext &context, const libMesh::Gradient &grad_u, const libMesh::Gradient &grad_v, const libMesh::Gradient &grad_w, libMesh::TensorValue< libMesh::Real > &a_cov, libMesh::TensorValue< libMesh::Real > &a_contra, libMesh::TensorValue< libMesh::Real > &A_cov, libMesh::TensorValue< libMesh::Real > &A_contra, libMesh::Real &lambda_sq)
std::vector< unsigned int > _stress_indices
Index from registering this quantity for postprocessing. Each component will have it's own index...
std::vector< unsigned int > _strain_indices
Index from registering this quantity for postprocessing. Each component will have it's own index...
const libMesh::Real two_pi
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.
const libMesh::FEGenericBase< libMesh::Real > * get_fe(const AssemblyContext &context)
template<typename StressStrainLaw >
void GRINS::ElasticMembrane< StressStrainLaw >::element_constraint ( bool  compute_jacobian,
AssemblyContext context,
CachedValues cache 
)
virtual

Constraint part(s) of physics for element interiors.

Reimplemented from GRINS::Physics.

Definition at line 291 of file elastic_membrane.C.

294  {
295  // Only compute the constraint is tracking lambda_sq as an independent variable
296  if( this->_is_compressible )
297  {
298  unsigned int n_qpoints = context.get_element_qrule().n_points();
299 
300  const unsigned int n_u_dofs = context.get_dof_indices(this->_disp_vars.u()).size();
301 
302  const std::vector<libMesh::Real> &JxW = context.get_element_fe(this->_lambda_sq_var)->get_JxW();
303 
304  libMesh::DenseSubVector<libMesh::Number>& Fl = context.get_elem_residual(this->_lambda_sq_var);
305 
306  const std::vector<std::vector<libMesh::Real> >& phi =
307  context.get_element_fe(this->_lambda_sq_var)->get_phi();
308 
309  const unsigned int n_lambda_sq_dofs = context.get_dof_indices(this->_lambda_sq_var).size();
310 
311  const libMesh::DenseSubVector<libMesh::Number>& u_coeffs = context.get_elem_solution( this->_disp_vars.u() );
312  const libMesh::DenseSubVector<libMesh::Number>& v_coeffs = context.get_elem_solution( this->_disp_vars.v() );
313  const libMesh::DenseSubVector<libMesh::Number>& w_coeffs = context.get_elem_solution( this->_disp_vars.w() );
314 
315  // All shape function gradients are w.r.t. master element coordinates
316  const std::vector<std::vector<libMesh::Real> >& dphi_dxi =
317  this->get_fe(context)->get_dphidxi();
318 
319  const std::vector<std::vector<libMesh::Real> >& dphi_deta =
320  this->get_fe(context)->get_dphideta();
321 
322  for (unsigned int qp=0; qp != n_qpoints; qp++)
323  {
324  libMesh::Real jac = JxW[qp];
325 
326  libMesh::Gradient grad_u, grad_v, grad_w;
327  for( unsigned int d = 0; d < n_u_dofs; d++ )
328  {
329  libMesh::RealGradient u_gradphi( dphi_dxi[d][qp], dphi_deta[d][qp] );
330  grad_u += u_coeffs(d)*u_gradphi;
331  grad_v += v_coeffs(d)*u_gradphi;
332  grad_w += w_coeffs(d)*u_gradphi;
333  }
334 
335  libMesh::TensorValue<libMesh::Real> a_cov, a_contra, A_cov, A_contra;
336  libMesh::Real lambda_sq = 0;
337 
338  this->compute_metric_tensors( qp, *(this->get_fe(context)), context,
339  grad_u, grad_v, grad_w,
340  a_cov, a_contra, A_cov, A_contra,
341  lambda_sq );
342 
343  libMesh::Real stress_33 = this->_stress_strain_law.compute_33_stress( a_contra, a_cov, A_contra, A_cov );
344 
345  for (unsigned int i=0; i != n_lambda_sq_dofs; i++)
346  {
347  Fl(i) += stress_33*phi[i][qp]*jac;
348  }
349 
350  if( compute_jacobian )
351  {
352  libmesh_not_implemented();
353  }
354  }
355  } // is_compressible
356  }
void compute_metric_tensors(unsigned int qp, const libMesh::FEBase &elem, const AssemblyContext &context, const libMesh::Gradient &grad_u, const libMesh::Gradient &grad_v, const libMesh::Gradient &grad_w, libMesh::TensorValue< libMesh::Real > &a_cov, libMesh::TensorValue< libMesh::Real > &a_contra, libMesh::TensorValue< libMesh::Real > &A_cov, libMesh::TensorValue< libMesh::Real > &A_contra, libMesh::Real &lambda_sq)
VariableIndex _lambda_sq_var
Variable index for lambda_sq variable.
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.
const libMesh::FEGenericBase< libMesh::Real > * get_fe(const AssemblyContext &context)
template<typename StressStrainLaw >
void GRINS::ElasticMembrane< StressStrainLaw >::element_time_derivative ( bool  compute_jacobian,
AssemblyContext context,
CachedValues  
)
virtual

Time dependent part(s) of physics for element interiors.

Reimplemented from GRINS::Physics.

Definition at line 116 of file elastic_membrane.C.

119  {
120  const unsigned int n_u_dofs = context.get_dof_indices(this->_disp_vars.u()).size();
121 
122  const std::vector<libMesh::Real> &JxW =
123  this->get_fe(context)->get_JxW();
124 
125  // Residuals that we're populating
126  libMesh::DenseSubVector<libMesh::Number> &Fu = context.get_elem_residual(this->_disp_vars.u());
127  libMesh::DenseSubVector<libMesh::Number> &Fv = context.get_elem_residual(this->_disp_vars.v());
128  libMesh::DenseSubVector<libMesh::Number> &Fw = context.get_elem_residual(this->_disp_vars.w());
129 
130  libMesh::DenseSubMatrix<libMesh::Number>& Kuu = context.get_elem_jacobian(this->_disp_vars.u(),this->_disp_vars.u());
131  libMesh::DenseSubMatrix<libMesh::Number>& Kuv = context.get_elem_jacobian(this->_disp_vars.u(),this->_disp_vars.v());
132  libMesh::DenseSubMatrix<libMesh::Number>& Kuw = context.get_elem_jacobian(this->_disp_vars.u(),this->_disp_vars.w());
133 
134  libMesh::DenseSubMatrix<libMesh::Number>& Kvu = context.get_elem_jacobian(this->_disp_vars.v(),this->_disp_vars.u());
135  libMesh::DenseSubMatrix<libMesh::Number>& Kvv = context.get_elem_jacobian(this->_disp_vars.v(),this->_disp_vars.v());
136  libMesh::DenseSubMatrix<libMesh::Number>& Kvw = context.get_elem_jacobian(this->_disp_vars.v(),this->_disp_vars.w());
137 
138  libMesh::DenseSubMatrix<libMesh::Number>& Kwu = context.get_elem_jacobian(this->_disp_vars.w(),this->_disp_vars.u());
139  libMesh::DenseSubMatrix<libMesh::Number>& Kwv = context.get_elem_jacobian(this->_disp_vars.w(),this->_disp_vars.v());
140  libMesh::DenseSubMatrix<libMesh::Number>& Kww = context.get_elem_jacobian(this->_disp_vars.w(),this->_disp_vars.w());
141 
142  unsigned int n_qpoints = context.get_element_qrule().n_points();
143 
144  // All shape function gradients are w.r.t. master element coordinates
145  const std::vector<std::vector<libMesh::Real> >& dphi_dxi =
146  this->get_fe(context)->get_dphidxi();
147 
148  const std::vector<std::vector<libMesh::Real> >& dphi_deta =
149  this->get_fe(context)->get_dphideta();
150 
151  const libMesh::DenseSubVector<libMesh::Number>& u_coeffs = context.get_elem_solution( this->_disp_vars.u() );
152  const libMesh::DenseSubVector<libMesh::Number>& v_coeffs = context.get_elem_solution( this->_disp_vars.v() );
153  const libMesh::DenseSubVector<libMesh::Number>& w_coeffs = context.get_elem_solution( this->_disp_vars.w() );
154 
155  // Need these to build up the covariant and contravariant metric tensors
156  const std::vector<libMesh::RealGradient>& dxdxi = this->get_fe(context)->get_dxyzdxi();
157  const std::vector<libMesh::RealGradient>& dxdeta = this->get_fe(context)->get_dxyzdeta();
158 
159  const unsigned int dim = 2; // The manifold dimension is always 2 for this physics
160 
161  for (unsigned int qp=0; qp != n_qpoints; qp++)
162  {
163  // Gradients are w.r.t. master element coordinates
164  libMesh::Gradient grad_u, grad_v, grad_w;
165  for( unsigned int d = 0; d < n_u_dofs; d++ )
166  {
167  libMesh::RealGradient u_gradphi( dphi_dxi[d][qp], dphi_deta[d][qp] );
168  grad_u += u_coeffs(d)*u_gradphi;
169  grad_v += v_coeffs(d)*u_gradphi;
170  grad_w += w_coeffs(d)*u_gradphi;
171  }
172 
173  libMesh::RealGradient grad_x( dxdxi[qp](0), dxdeta[qp](0) );
174  libMesh::RealGradient grad_y( dxdxi[qp](1), dxdeta[qp](1) );
175  libMesh::RealGradient grad_z( dxdxi[qp](2), dxdeta[qp](2) );
176 
177 
178  libMesh::TensorValue<libMesh::Real> a_cov, a_contra, A_cov, A_contra;
179  libMesh::Real lambda_sq = 0;
180 
181  this->compute_metric_tensors( qp, *(this->get_fe(context)), context,
182  grad_u, grad_v, grad_w,
183  a_cov, a_contra, A_cov, A_contra,
184  lambda_sq );
185 
186  // Compute stress and elasticity tensors
188  ElasticityTensor C;
189  this->_stress_strain_law.compute_stress_and_elasticity(dim,a_contra,a_cov,A_contra,A_cov,tau,C);
190 
191  libMesh::Real jac = JxW[qp];
192 
193  for (unsigned int i=0; i != n_u_dofs; i++)
194  {
195  libMesh::RealGradient u_gradphi( dphi_dxi[i][qp], dphi_deta[i][qp] );
196 
197  for( unsigned int alpha = 0; alpha < dim; alpha++ )
198  {
199  for( unsigned int beta = 0; beta < dim; beta++ )
200  {
201  libMesh::Real factor = 0.5*tau(alpha,beta)*this->_h0*jac;
202 
203  Fu(i) += factor*( (grad_x(beta) + grad_u(beta))*u_gradphi(alpha) +
204  (grad_x(alpha) + grad_u(alpha))*u_gradphi(beta) );
205 
206  Fv(i) += factor*( (grad_y(beta) + grad_v(beta))*u_gradphi(alpha) +
207  (grad_y(alpha) + grad_v(alpha))*u_gradphi(beta) );
208 
209  Fw(i) += factor*( (grad_z(beta) + grad_w(beta))*u_gradphi(alpha) +
210  (grad_z(alpha) + grad_w(alpha))*u_gradphi(beta) );
211  }
212  }
213  }
214 
215  if( compute_jacobian )
216  {
217  for (unsigned int i=0; i != n_u_dofs; i++)
218  {
219  libMesh::RealGradient u_gradphi_i( dphi_dxi[i][qp], dphi_deta[i][qp] );
220 
221  for (unsigned int j=0; j != n_u_dofs; j++)
222  {
223  libMesh::RealGradient u_gradphi_j( dphi_dxi[j][qp], dphi_deta[j][qp] );
224 
225  for( unsigned int alpha = 0; alpha < dim; alpha++ )
226  {
227  for( unsigned int beta = 0; beta < dim; beta++ )
228  {
229  const libMesh::Real diag_term = 0.5*this->_h0*jac*tau(alpha,beta)*context.get_elem_solution_derivative()*
230  ( u_gradphi_j(beta)*u_gradphi_i(alpha) +
231  u_gradphi_j(alpha)*u_gradphi_i(beta) );
232  Kuu(i,j) += diag_term;
233 
234  Kvv(i,j) += diag_term;
235 
236  Kww(i,j) += diag_term;
237 
238  for( unsigned int lambda = 0; lambda < dim; lambda++ )
239  {
240  for( unsigned int mu = 0; mu < dim; mu++ )
241  {
242  const libMesh::Real dgamma_du = 0.5*( u_gradphi_j(lambda)*(grad_x(mu)+grad_u(mu)) +
243  (grad_x(lambda)+grad_u(lambda))*u_gradphi_j(mu) );
244 
245  const libMesh::Real dgamma_dv = 0.5*( u_gradphi_j(lambda)*(grad_y(mu)+grad_v(mu)) +
246  (grad_y(lambda)+grad_v(lambda))*u_gradphi_j(mu) );
247 
248  const libMesh::Real dgamma_dw = 0.5*( u_gradphi_j(lambda)*(grad_z(mu)+grad_w(mu)) +
249  (grad_z(lambda)+grad_w(lambda))*u_gradphi_j(mu) );
250 
251  const libMesh::Real C1 = 0.5*this->_h0*jac*C(alpha,beta,lambda,mu)*context.get_elem_solution_derivative();
252 
253  const libMesh::Real x_term = C1*( (grad_x(beta)+grad_u(beta))*u_gradphi_i(alpha) +
254  (grad_x(alpha)+grad_u(alpha))*u_gradphi_i(beta) );
255 
256  const libMesh::Real y_term = C1*( (grad_y(beta)+grad_v(beta))*u_gradphi_i(alpha) +
257  (grad_y(alpha)+grad_v(alpha))*u_gradphi_i(beta) );
258 
259  const libMesh::Real z_term = C1*( (grad_z(beta)+grad_w(beta))*u_gradphi_i(alpha) +
260  (grad_z(alpha)+grad_w(alpha))*u_gradphi_i(beta) );
261 
262  Kuu(i,j) += x_term*dgamma_du;
263 
264  Kuv(i,j) += x_term*dgamma_dv;
265 
266  Kuw(i,j) += x_term*dgamma_dw;
267 
268  Kvu(i,j) += y_term*dgamma_du;
269 
270  Kvv(i,j) += y_term*dgamma_dv;
271 
272  Kvw(i,j) += y_term*dgamma_dw;
273 
274  Kwu(i,j) += z_term*dgamma_du;
275 
276  Kwv(i,j) += z_term*dgamma_dv;
277 
278  Kww(i,j) += z_term*dgamma_dw;
279  }
280  }
281  }
282  }
283  }
284  }
285  }
286 
287  }
288  }
void compute_metric_tensors(unsigned int qp, const libMesh::FEBase &elem, const AssemblyContext &context, const libMesh::Gradient &grad_u, const libMesh::Gradient &grad_v, const libMesh::Gradient &grad_w, libMesh::TensorValue< libMesh::Real > &a_cov, libMesh::TensorValue< libMesh::Real > &a_contra, libMesh::TensorValue< libMesh::Real > &A_cov, libMesh::TensorValue< libMesh::Real > &A_contra, libMesh::Real &lambda_sq)
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 _h0
Membrane thickness.
const libMesh::FEGenericBase< libMesh::Real > * get_fe(const AssemblyContext &context)
template<typename StressStrainLaw >
virtual void GRINS::ElasticMembrane< StressStrainLaw >::mass_residual ( bool  compute_jacobian,
AssemblyContext context,
CachedValues cache 
)
inlinevirtual

Mass matrix part(s) for element interiors. All boundary terms lie within the time_derivative part.

Reimplemented from GRINS::Physics.

Definition at line 56 of file elastic_membrane.h.

References GRINS::ElasticMembraneBase< StressStrainLaw >::mass_residual_impl().

59  { this->mass_residual_impl(compute_jacobian,
60  context,
61  &libMesh::FEMContext::interior_accel,
62  &libMesh::DiffContext::get_elem_solution_accel_derivative); }
void mass_residual_impl(bool compute_jacobian, AssemblyContext &context, InteriorFuncType interior_solution, VarDerivType get_solution_deriv, libMesh::Real mu=1.0)
Implementation of mass_residual.
template<typename StressStrainLaw >
void GRINS::ElasticMembrane< StressStrainLaw >::register_postprocessing_vars ( const GetPot &  input,
PostProcessedQuantities< libMesh::Real > &  postprocessing 
)
virtual

Register postprocessing variables for ElasticMembrane.

Reimplemented from GRINS::Physics.

Definition at line 54 of file elastic_membrane.C.

References GRINS::PhysicsNaming::elastic_membrane(), and GRINS::PostProcessedQuantities< NumericType >::register_quantity().

56  {
57  std::string section = "Physics/"+PhysicsNaming::elastic_membrane()+"/output_vars";
58 
59  if( input.have_variable(section) )
60  {
61  unsigned int n_vars = input.vector_variable_size(section);
62 
63  for( unsigned int v = 0; v < n_vars; v++ )
64  {
65  std::string name = input(section,"DIE!",v);
66 
67  if( name == std::string("stress") )
68  {
69  // sigma_xx, sigma_xy, sigma_yy, sigma_yx = sigma_xy
70  // sigma_zz = 0 by assumption of this Physics
71  _stress_indices.resize(7);
72 
73  this->_stress_indices[0] = postprocessing.register_quantity("stress_xx");
74 
75  this->_stress_indices[1] = postprocessing.register_quantity("stress_xy");
76 
77  this->_stress_indices[2] = postprocessing.register_quantity("stress_yy");
78 
79  this->_stress_indices[3] = postprocessing.register_quantity("sigma_max");
80 
81  this->_stress_indices[4] = postprocessing.register_quantity("sigma_1");
82 
83  this->_stress_indices[5] = postprocessing.register_quantity("sigma_2");
84 
85  this->_stress_indices[6] = postprocessing.register_quantity("sigma_3");
86  }
87  else if( name == std::string( "stress_zz" ) )
88  {
89  // This is mostly for sanity checking the plane stress condition
90  this->_stress_zz_index = postprocessing.register_quantity("stress_zz");
91  }
92  else if( name == std::string("strain") )
93  {
94  // eps_xx, eps_xy, eps_yy, eps_yx = eps_xy
95  _strain_indices.resize(3);
96 
97  this->_strain_indices[0] = postprocessing.register_quantity("strain_xx");
98 
99  this->_strain_indices[1] = postprocessing.register_quantity("strain_xy");
100 
101  this->_strain_indices[2] = postprocessing.register_quantity("strain_yy");
102  }
103  else
104  {
105  std::cerr << "Error: Invalue output_vars value for "+PhysicsNaming::elastic_membrane() << std::endl
106  << " Found " << name << std::endl
107  << " Acceptable values are: stress" << std::endl
108  << " strain" << std::endl;
109  libmesh_error();
110  }
111  }
112  }
113  }
unsigned int _stress_zz_index
Index from registering sigma_zz for postprocessing. Mainly for sanity checking.
std::vector< unsigned int > _stress_indices
Index from registering this quantity for postprocessing. Each component will have it's own index...
static PhysicsName elastic_membrane()
std::vector< unsigned int > _strain_indices
Index from registering this quantity for postprocessing. Each component will have it's own index...

Member Data Documentation

template<typename StressStrainLaw >
std::vector<unsigned int> GRINS::ElasticMembrane< StressStrainLaw >::_strain_indices
private

Index from registering this quantity for postprocessing. Each component will have it's own index.

Definition at line 81 of file elastic_membrane.h.

template<typename StressStrainLaw >
std::vector<unsigned int> GRINS::ElasticMembrane< StressStrainLaw >::_stress_indices
private

Index from registering this quantity for postprocessing. Each component will have it's own index.

Definition at line 75 of file elastic_membrane.h.

template<typename StressStrainLaw >
unsigned int GRINS::ElasticMembrane< StressStrainLaw >::_stress_zz_index
private

Index from registering sigma_zz for postprocessing. Mainly for sanity checking.

Definition at line 78 of file elastic_membrane.h.


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

Generated on Thu Jun 2 2016 21:52:30 for GRINS-0.7.0 by  doxygen 1.8.10