G+Smo  24.08.0
Geometry + Simulation Modules
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
gsMuscleAssembler.hpp
Go to the documentation of this file.
1 
15 #pragma once
16 
18 
20 
21 // Element visitors
24 
25 namespace gismo
26 {
27 
28 template<class T>
30  gsMultiBasis<T> const & basisDisp,
31  gsMultiBasis<T> const & basisPres,
32  gsBoundaryConditions<T> const & bconditions,
33  gsFunction<T> const & body_force,
34  gsPiecewiseFunction<T> const & muscleTendonDistribution,
35  const gsVector<T> & fiberDirection)
36  : gsElasticityAssembler<T>(patches,basisDisp,basisPres,bconditions,body_force),
37  muscleTendon(muscleTendonDistribution),
38  fiberDir(fiberDirection)
39 {
40 
41  m_options.addReal("MuscleYoungsModulus","Youngs modulus of the muscle tissue",3.0e5);
42  m_options.addReal("TendonYoungsModulus","Youngs modulus of the tendon tissue",3.0e6);
43  m_options.addReal("MusclePoissonsRatio","Poisson's ratio of the muscle tissue",0.5);
44  m_options.addReal("TendonPoissonsRatio","Poisson's ratio of the tendon tissue",0.5);
45  m_options.addReal("MaxMuscleStress","Maximum stress produced at the optimal fiber stretch",3.0e5);
46  m_options.addReal("OptFiberStretch","Optimal fiber stretch",1.3);
47  m_options.addReal("DeltaW","Shape parameter of the active reponse function",0.3);
48  m_options.addReal("PowerNu","Shape parameter of the active reponse function",4.0);
49  m_options.addReal("Alpha","Activation parameter of the active muscle response",0.);
50 
51  m_options.setInt("MaterialLaw",material_law::muscle);
52 }
53 
54 //--------------------- SYSTEM ASSEMBLY ----------------------------------//
55 
56 
57 template<class T>
58 bool gsMuscleAssembler<T>::assemble(const gsMatrix<T> & solutionVector,
59  const std::vector<gsMatrix<T> > & fixedDoFs)
60 {
61  gsMultiPatch<T> displacement,pressure;
62  Base::constructSolution(solutionVector,fixedDoFs,displacement,pressure);
63  if (m_options.getSwitch("Check"))
64  if (checkDisplacement(m_pde_ptr->patches(),displacement) != -1)
65  return false;
66 
67  m_system.matrix().setZero();
68  Base::reserve();
69  m_system.rhs().setZero();
70 
71  // Compute volumetric integrals and write to the global linear systemz
72  gsVisitorMuscle<T> visitor(*m_pde_ptr,muscleTendon,fiberDir,displacement,pressure);
73  Base::template push<gsVisitorMuscle<T> >(visitor);
74  // Compute surface integrals and write to the global rhs vector
75  // change to reuse rhs from linear system
76  Base::template push<gsVisitorElasticityNeumann<T> >(m_pde_ptr->bc().neumannSides());
77 
78  m_system.matrix().makeCompressed();
79 
80  return true;
81 }
82 
83 //--------------------- SPECIALS ----------------------------------//
84 
85 template<class T>
87  const gsMultiPatch<T> & pressure,
88  gsPiecewiseFunction<T> & result,
90 {
92  GISMO_ENSURE(Base::m_dim == 2, "Invalid stress components for a 2D problem");
95  GISMO_ENSURE(Base::m_dim == 3, "Invalid stress type for a 3D problem");
96  result.clear();
97 
98  for (size_t p = 0; p < m_pde_ptr->domain().nPatches(); ++p )
99  result.addPiecePointer(new gsCauchyStressFunction<T>(p,comp,m_options,
100  &(m_pde_ptr->domain()), &displacement, &pressure));
101 }
102 
103 }// namespace gismo ends
Compute Cauchy stresses for a previously computed/defined displacement field. Can be pushed into gsPi...
Definition: gsElasticityFunctions.h:29
Visitor class for the surface load integration.
gsOptionList m_options
Options.
Definition: gsAssembler.h:285
#define GISMO_ENSURE(cond, message)
Definition: gsDebug.h:102
A function from a n-dimensional domain to an m-dimensional image.
Definition: gsFunction.h:59
Provides elasticity systems for muscle simulations.
return von Mises stress as a scala
Definition: gsBaseUtils.h:114
Assembles the stiffness matrix and the right-hand side vector for linear and nonlinear elasticity for...
Definition: gsElasticityAssembler.h:31
Provides isogeometric meshing and modelling routines.
void setInt(const std::string &label, const index_t &value)
Sets an existing option label to be equal to value.
Definition: gsOptionList.cpp:158
Holds a set of patch-wise bases and their topology information.
Definition: gsMultiBasis.h:36
S = p*C^-1 + mu*(I-C^-1)
Definition: gsBaseUtils.h:136
Container class for a set of geometry patches and their topology, that is, the interface connections ...
Definition: gsMultiPatch.h:33
void clear()
Clear (delete) all functions.
Definition: gsPiecewiseFunction.h:148
Visitor class for the nonlinear elasticity solver with a muscle material. The material model is based...
index_t checkDisplacement(gsMultiPatch< T > const &domain, gsMultiPatch< T > const &displacement)
Checks whether the deformed configuration is bijective, i.e. det(Jac(geo+disp)) &gt; 0; returns -1 if ye...
Definition: gsGeoUtils.hpp:245
Class containing a set of boundary conditions.
Definition: gsBoundaryConditions.h:341
void addReal(const std::string &label, const std::string &desc, const Real &value)
Adds a option named label, with description desc and value value.
Definition: gsOptionList.cpp:211
return all components of the 2D stress tensor as a 2x2 matrix
Definition: gsBaseUtils.h:117
Definition: gsBaseUtils.h:119
A function depending on an index i, typically referring to a patch/sub-domain. On each patch a differ...
Definition: gsPiecewiseFunction.h:28
virtual void assemble()
Main assemble routine, to be implemented in derived classes.
Definition: gsAssembler.hpp:51
virtual void constructCauchyStresses(const gsMultiPatch< T > &displacement, const gsMultiPatch< T > &pressure, gsPiecewiseFunction< T > &result, stress_components::components component=stress_components::von_mises) const
Construct Cauchy stresses for evaluation or visualization.
Definition: gsMuscleAssembler.hpp:86
Definition: gsBaseUtils.h:116
components
Definition: gsBaseUtils.h:111
gsMuscleAssembler(const gsMultiPatch< T > &patches, const gsMultiBasis< T > &basisDisp, const gsMultiBasis< T > &basisPres, const gsBoundaryConditions< T > &bconditions, const gsFunction< T > &body_force, const gsPiecewiseFunction< T > &tendonMuscleDistribution, const gsVector< T > &fiberDirection)
Constructor of mixed formulation (displacement + pressure)
Definition: gsMuscleAssembler.hpp:29
Definition: gsBaseUtils.h:121