-
Notifications
You must be signed in to change notification settings - Fork 358
[FEM.HyperElastic] Integration of hyperelasticity from Elasticity plugin to SOFA #6206
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
alxbilger
wants to merge
8
commits into
sofa-framework:master
Choose a base branch
from
alxbilger:hyperelasticity
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+2,870
−2
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
2628069
introduce hyperelaticity from Elasticity plugin
alxbilger adc04c7
add pk2 material
alxbilger 28c2d30
add all materials from Elasticity
alxbilger a2fea1a
add license header
alxbilger 2f2fbca
call registration in the factory
alxbilger f80d39d
add validation scenes
alxbilger 89927b2
missing typename keyword
alxbilger 0cd9f4f
missing typename keyword 2
alxbilger File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
.../HyperElastic/src/sofa/component/solidmechanics/fem/hyperelastic/HyperelasticMaterial.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| /****************************************************************************** | ||
| * SOFA, Simulation Open-Framework Architecture * | ||
| * (c) 2006 INRIA, USTL, UJF, CNRS, MGH * | ||
| * * | ||
| * This program is free software; you can redistribute it and/or modify it * | ||
| * under the terms of the GNU Lesser General Public License as published by * | ||
| * the Free Software Foundation; either version 2.1 of the License, or (at * | ||
| * your option) any later version. * | ||
| * * | ||
| * This program is distributed in the hope that it will be useful, but WITHOUT * | ||
| * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * | ||
| * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * | ||
| * for more details. * | ||
| * * | ||
| * You should have received a copy of the GNU Lesser General Public License * | ||
| * along with this program. If not, see <http://www.gnu.org/licenses/>. * | ||
| ******************************************************************************* | ||
| * Authors: The SOFA Team and external contributors (see Authors.txt) * | ||
| * * | ||
| * Contact information: contact@sofa-framework.org * | ||
| ******************************************************************************/ | ||
| #define ELASTICITY_COMPONENT_HYPERELASTIC_MATERIAL_CPP | ||
|
|
||
| #include <sofa/component/solidmechanics/fem/hyperelastic/HyperelasticMaterial.inl> | ||
| #include <sofa/defaulttype/VecTypes.h> | ||
|
|
||
| namespace sofa::component::solidmechanics::fem::hyperelastic | ||
| { | ||
|
|
||
| template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_HYPERELASTIC_API HyperelasticMaterial<sofa::defaulttype::Vec1Types>; | ||
| template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_HYPERELASTIC_API HyperelasticMaterial<sofa::defaulttype::Vec2Types>; | ||
| template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_HYPERELASTIC_API HyperelasticMaterial<sofa::defaulttype::Vec3Types>; | ||
|
|
||
| } |
82 changes: 82 additions & 0 deletions
82
...EM/HyperElastic/src/sofa/component/solidmechanics/fem/hyperelastic/HyperelasticMaterial.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| /****************************************************************************** | ||
| * SOFA, Simulation Open-Framework Architecture * | ||
| * (c) 2006 INRIA, USTL, UJF, CNRS, MGH * | ||
| * * | ||
| * This program is free software; you can redistribute it and/or modify it * | ||
| * under the terms of the GNU Lesser General Public License as published by * | ||
| * the Free Software Foundation; either version 2.1 of the License, or (at * | ||
| * your option) any later version. * | ||
| * * | ||
| * This program is distributed in the hope that it will be useful, but WITHOUT * | ||
| * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * | ||
| * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * | ||
| * for more details. * | ||
| * * | ||
| * You should have received a copy of the GNU Lesser General Public License * | ||
| * along with this program. If not, see <http://www.gnu.org/licenses/>. * | ||
| ******************************************************************************* | ||
| * Authors: The SOFA Team and external contributors (see Authors.txt) * | ||
| * * | ||
| * Contact information: contact@sofa-framework.org * | ||
| ******************************************************************************/ | ||
| #pragma once | ||
|
|
||
| #include <sofa/component/solidmechanics/fem/hyperelastic/config.h> | ||
| #include <sofa/type/FullySymmetric4Tensor.h> | ||
| #include <sofa/component/solidmechanics/fem/hyperelastic/impl/MajorSymmetric4Tensor.h> | ||
| #include <sofa/component/solidmechanics/fem/hyperelastic/impl/Strain.h> | ||
| #include <sofa/core/objectmodel/BaseObject.h> | ||
|
|
||
| #if !defined(ELASTICITY_COMPONENT_HYPERELASTIC_MATERIAL_CPP) | ||
| #include <sofa/defaulttype/VecTypes.h> | ||
| #endif | ||
|
|
||
| namespace sofa::component::solidmechanics::fem::hyperelastic | ||
| { | ||
|
|
||
| template<class TDataTypes> | ||
| class HyperelasticMaterial : public virtual sofa::core::objectmodel::BaseObject | ||
| { | ||
| public: | ||
| SOFA_ABSTRACT_CLASS(HyperelasticMaterial<TDataTypes>, sofa::core::objectmodel::BaseObject); | ||
| using DataTypes = TDataTypes; | ||
|
|
||
| protected: | ||
| using Real = sofa::Real_t<DataTypes>; | ||
|
|
||
| static constexpr sofa::Size spatial_dimensions = DataTypes::spatial_dimensions; | ||
|
|
||
| using DeformationGradient = sofa::type::Mat<spatial_dimensions, spatial_dimensions, Real>; | ||
| using RightCauchyGreenTensor = sofa::type::Mat<spatial_dimensions, spatial_dimensions, Real>; | ||
| using StressTensor = sofa::type::Mat<spatial_dimensions, spatial_dimensions, Real>; | ||
| using ElasticityTensor = sofa::type::FullySymmetric4Tensor<spatial_dimensions, Real>; | ||
| using TangentModulus = MajorSymmetric4Tensor<DataTypes>; | ||
|
|
||
| public: | ||
| void init() override; | ||
|
|
||
| /** | ||
| * Computes the First Piola-Kirchhoff stress tensor for a given deformation gradient. | ||
| * | ||
| * It corresponds to the derivative of the strain energy density function w.r.t. deformation | ||
| * gradient. | ||
| */ | ||
| virtual StressTensor firstPiolaKirchhoffStress(Strain<DataTypes>& strain) = 0; | ||
|
|
||
| /** | ||
| * Compute the jacobian of the first Piola-Kirchhoff stress tensor with respect to the | ||
| * deformation gradient. | ||
| * | ||
| * It is called the material tangent modulus. | ||
| */ | ||
| virtual TangentModulus materialTangentModulus(Strain<DataTypes>& strain) = 0; | ||
|
|
||
| }; | ||
|
|
||
| #if !defined(ELASTICITY_COMPONENT_HYPERELASTIC_MATERIAL_CPP) | ||
| extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_HYPERELASTIC_API HyperelasticMaterial<sofa::defaulttype::Vec1Types>; | ||
| extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_HYPERELASTIC_API HyperelasticMaterial<sofa::defaulttype::Vec2Types>; | ||
| extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_HYPERELASTIC_API HyperelasticMaterial<sofa::defaulttype::Vec3Types>; | ||
| #endif | ||
|
|
||
| } |
39 changes: 39 additions & 0 deletions
39
.../HyperElastic/src/sofa/component/solidmechanics/fem/hyperelastic/HyperelasticMaterial.inl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| /****************************************************************************** | ||
| * SOFA, Simulation Open-Framework Architecture * | ||
| * (c) 2006 INRIA, USTL, UJF, CNRS, MGH * | ||
| * * | ||
| * This program is free software; you can redistribute it and/or modify it * | ||
| * under the terms of the GNU Lesser General Public License as published by * | ||
| * the Free Software Foundation; either version 2.1 of the License, or (at * | ||
| * your option) any later version. * | ||
| * * | ||
| * This program is distributed in the hope that it will be useful, but WITHOUT * | ||
| * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * | ||
| * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * | ||
| * for more details. * | ||
| * * | ||
| * You should have received a copy of the GNU Lesser General Public License * | ||
| * along with this program. If not, see <http://www.gnu.org/licenses/>. * | ||
| ******************************************************************************* | ||
| * Authors: The SOFA Team and external contributors (see Authors.txt) * | ||
| * * | ||
| * Contact information: contact@sofa-framework.org * | ||
| ******************************************************************************/ | ||
| #pragma once | ||
| #include <sofa/component/solidmechanics/fem/hyperelastic/HyperelasticMaterial.h> | ||
|
|
||
| namespace sofa::component::solidmechanics::fem::hyperelastic | ||
| { | ||
|
|
||
| template <class DataTypes> | ||
| void HyperelasticMaterial<DataTypes>::init() | ||
| { | ||
| sofa::core::objectmodel::BaseObject::init(); | ||
|
|
||
| if (!this->isComponentStateInvalid()) | ||
| { | ||
| this->d_componentState.setValue(sofa::core::objectmodel::ComponentState::Valid); | ||
| } | ||
| } | ||
|
|
||
| } // namespace elasticity |
57 changes: 57 additions & 0 deletions
57
...astic/src/sofa/component/solidmechanics/fem/hyperelastic/HyperelasticityFEMForceField.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| /****************************************************************************** | ||
| * SOFA, Simulation Open-Framework Architecture * | ||
| * (c) 2006 INRIA, USTL, UJF, CNRS, MGH * | ||
| * * | ||
| * This program is free software; you can redistribute it and/or modify it * | ||
| * under the terms of the GNU Lesser General Public License as published by * | ||
| * the Free Software Foundation; either version 2.1 of the License, or (at * | ||
| * your option) any later version. * | ||
| * * | ||
| * This program is distributed in the hope that it will be useful, but WITHOUT * | ||
| * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * | ||
| * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * | ||
| * for more details. * | ||
| * * | ||
| * You should have received a copy of the GNU Lesser General Public License * | ||
| * along with this program. If not, see <http://www.gnu.org/licenses/>. * | ||
| ******************************************************************************* | ||
| * Authors: The SOFA Team and external contributors (see Authors.txt) * | ||
| * * | ||
| * Contact information: contact@sofa-framework.org * | ||
| ******************************************************************************/ | ||
| #define ELASTICITY_COMPONENT_HYPERLASTICITY_FEM_FORCE_FIELD_CPP | ||
|
|
||
| #include <sofa/component/solidmechanics/fem/hyperelastic/HyperelasticityFEMForceField.inl> | ||
|
|
||
| #include <sofa/fem/FiniteElement[all].h> | ||
| #include <sofa/core/ObjectFactory.h> | ||
|
|
||
| namespace sofa::component::solidmechanics::fem::hyperelastic | ||
| { | ||
|
|
||
| void registerHyperelasticityFEMForceField(sofa::core::ObjectFactory* factory) | ||
| { | ||
| factory->registerObjects(sofa::core::ObjectRegistrationData("Hyperelasticity") | ||
| .add< HyperelasticityFEMForceField<sofa::defaulttype::Vec1Types, sofa::geometry::Edge> >() | ||
| .add< HyperelasticityFEMForceField<sofa::defaulttype::Vec2Types, sofa::geometry::Edge> >() | ||
| .add< HyperelasticityFEMForceField<sofa::defaulttype::Vec3Types, sofa::geometry::Edge> >() | ||
| .add< HyperelasticityFEMForceField<sofa::defaulttype::Vec2Types, sofa::geometry::Triangle> >() | ||
| .add< HyperelasticityFEMForceField<sofa::defaulttype::Vec3Types, sofa::geometry::Triangle> >() | ||
| .add< HyperelasticityFEMForceField<sofa::defaulttype::Vec2Types, sofa::geometry::Quad> >() | ||
| .add< HyperelasticityFEMForceField<sofa::defaulttype::Vec3Types, sofa::geometry::Quad> >() | ||
| .add< HyperelasticityFEMForceField<sofa::defaulttype::Vec3Types, sofa::geometry::Tetrahedron> >() | ||
| .add< HyperelasticityFEMForceField<sofa::defaulttype::Vec3Types, sofa::geometry::Hexahedron> >() | ||
| ); | ||
| } | ||
|
|
||
| template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_HYPERELASTIC_API HyperelasticityFEMForceField<sofa::defaulttype::Vec1Types, sofa::geometry::Edge>; | ||
| template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_HYPERELASTIC_API HyperelasticityFEMForceField<sofa::defaulttype::Vec2Types, sofa::geometry::Edge>; | ||
| template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_HYPERELASTIC_API HyperelasticityFEMForceField<sofa::defaulttype::Vec3Types, sofa::geometry::Edge>; | ||
| template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_HYPERELASTIC_API HyperelasticityFEMForceField<sofa::defaulttype::Vec2Types, sofa::geometry::Triangle>; | ||
| template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_HYPERELASTIC_API HyperelasticityFEMForceField<sofa::defaulttype::Vec3Types, sofa::geometry::Triangle>; | ||
| template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_HYPERELASTIC_API HyperelasticityFEMForceField<sofa::defaulttype::Vec2Types, sofa::geometry::Quad>; | ||
| template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_HYPERELASTIC_API HyperelasticityFEMForceField<sofa::defaulttype::Vec3Types, sofa::geometry::Quad>; | ||
| template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_HYPERELASTIC_API HyperelasticityFEMForceField<sofa::defaulttype::Vec3Types, sofa::geometry::Tetrahedron>; | ||
| template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_HYPERELASTIC_API HyperelasticityFEMForceField<sofa::defaulttype::Vec3Types, sofa::geometry::Hexahedron>; | ||
|
|
||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.