G+Smo  25.01.0
Geometry + Simulation Modules
 
Loading...
Searching...
No Matches
gsMuscleAssembler.hpp
Go to the documentation of this file.
1
15#pragma once
16
18
20
21// Element visitors
24
25namespace gismo
26{
27
28template<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
52}
53
54//--------------------- SYSTEM ASSEMBLY ----------------------------------//
55
56
57template<class T>
58bool 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
85template<class T>
87 const gsMultiPatch<T> & pressure,
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
gsOptionList m_options
Options.
Definition gsAssembler.h:285
Class containing a set of boundary conditions.
Definition gsBoundaryConditions.h:342
Compute Cauchy stresses for a previously computed/defined displacement field. Can be pushed into gsPi...
Definition gsElasticityFunctions.h:30
Assembles the stiffness matrix and the right-hand side vector for linear and nonlinear elasticity for...
Definition gsElasticityAssembler.h:32
A function from a n-dimensional domain to an m-dimensional image.
Definition gsFunction.h:60
A matrix with arbitrary coefficient type and fixed or dynamic size.
Definition gsMatrix.h:41
Holds a set of patch-wise bases and their topology information.
Definition gsMultiBasis.h:37
Container class for a set of geometry patches and their topology, that is, the interface connections ...
Definition gsMultiPatch.h:100
virtual void assemble()
Definition gsElasticityAssembler.h:62
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
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
void setInt(const std::string &label, const index_t &value)
Sets an existing option label to be equal to value.
Definition gsOptionList.cpp:158
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
A function depending on an index i, typically referring to a patch/sub-domain. On each patch a differ...
Definition gsPiecewiseFunction.h:29
void clear()
Clear (delete) all functions.
Definition gsPiecewiseFunction.h:148
A vector with arbitrary coefficient type and fixed or dynamic size.
Definition gsVector.h:37
#define GISMO_ENSURE(cond, message)
Definition gsDebug.h:102
Provides isogeometric meshing and modelling routines.
Provides elasticity systems for muscle simulations.
Visitor class for the surface load integration.
Visitor class for the nonlinear elasticity solver with a muscle material. The material model is based...
The G+Smo namespace, containing all definitions for the library.
index_t checkDisplacement(gsMultiPatch< T > const &domain, gsMultiPatch< T > const &displacement)
Checks whether the deformed configuration is bijective, i.e. det(Jac(geo+disp)) > 0; returns -1 if ye...
Definition gsGeoUtils.hpp:245
@ muscle
S = p*C^-1 + mu*(I-C^-1)
Definition gsBaseUtils.h:136
components
Definition gsBaseUtils.h:112
@ normal_3D_vector
return all components of the 2D stress tensor as a 2x2 matrix
Definition gsBaseUtils.h:117
@ shear_3D_vector
Definition gsBaseUtils.h:119
@ all_3D_matrix
Definition gsBaseUtils.h:121
@ all_2D_vector
return von Mises stress as a scala
Definition gsBaseUtils.h:114
@ all_2D_matrix
Definition gsBaseUtils.h:116