Skip to content
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

[IWIP] add a wrapper for (hyper)elastic materials from the muesli library #337

Draft
wants to merge 31 commits into
base: main
Choose a base branch
from

Conversation

henrij22
Copy link
Collaborator

@henrij22 henrij22 commented Nov 13, 2024

DO NOT MERGE YET
before

@henrij22 henrij22 self-assigned this Nov 13, 2024
@henrij22 henrij22 added the enhancement New request to enhance existing features label Nov 13, 2024
@henrij22 henrij22 changed the title [WIP] add a wrapper for elastic materials from the muesli library [WIP] add a wrapper for (hyper)elastic materials from the muesli library Nov 15, 2024
Copy link

codecov bot commented Nov 15, 2024

Codecov Report

Attention: Patch coverage is 98.21429% with 2 lines in your changes missing coverage. Please review.

Project coverage is 80.33%. Comparing base (13b6e50) to head (a2890c8).

Files with missing lines Patch % Lines
...ements/mechanics/materials/muesli/mueslihelpers.hh 96.77% 1 Missing ⚠️
...ents/mechanics/materials/muesli/mueslimaterials.hh 87.50% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #337      +/-   ##
==========================================
+ Coverage   78.99%   80.33%   +1.33%     
==========================================
  Files          69       73       +4     
  Lines        2238     2349     +111     
==========================================
+ Hits         1768     1887     +119     
+ Misses        470      462       -8     
Flag Coverage Δ
tests 80.33% <98.21%> (+1.33%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@tarun-mitruka tarun-mitruka mentioned this pull request Nov 21, 2024
11 tasks
Copy link
Collaborator

@tarun-mitruka tarun-mitruka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Henri for this PR. Comparing it with #333, I think from this PR we not only get LinearAnisotropic and LinearOrthotropic as the new material models, but also now have an interface to work with Muesli material models, which can be used later for instance to incorporate plasticity, etc. I would also propose the following:

CHANGELOG.md Outdated Show resolved Hide resolved
cmake/modules/AddMuesliFlags.cmake Show resolved Hide resolved
python/ikarus/materials/__init__.py Outdated Show resolved Hide resolved
python/ikarus/materials/__init__.py Outdated Show resolved Hide resolved
tests/src/testmaterial.cpp Outdated Show resolved Hide resolved
tests/src/testmaterialswithmuesli.cpp Outdated Show resolved Hide resolved
tests/src/testmaterialswithmuesli.cpp Outdated Show resolved Hide resolved
@henrij22 henrij22 changed the title [WIP] add a wrapper for (hyper)elastic materials from the muesli library [In REVIEW] add a wrapper for (hyper)elastic materials from the muesli library Nov 28, 2024
@henrij22 henrij22 changed the title [In REVIEW] add a wrapper for (hyper)elastic materials from the muesli library [IWIP] add a wrapper for (hyper)elastic materials from the muesli library Nov 28, 2024
}

/**
* \brief Converts the entries of a Eigen::Matrix to a provided muesli::tensor (symmetric 2nd order tensor).
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All these conversions should not be needed if muesli is configured with WITHEIGEN=TRUE. Then istensor is basically an eigen object https://bitbucket.org/ignromero/muesli/src/27e8204971602cb042d633b8b5f87761272b10df/muesli/tensor.h?at=master#lines-55

mutable itensor4 tangentModuli_{};

template <typename Derived>
void updateState(const Eigen::MatrixBase<Derived>& C) const {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A method called updateState should not be marked const. If the strain objects are directly Eigen types then you also do not need the evil mutable variables.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can of course get rid of the mutable variables, my motivation was to avoid allocating at each evaluation

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As we couldn't get Eigen to work, should we leave it like that or should I get rid of the mutable member variables?

Copy link
Collaborator

@rath3t rath3t left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks quite nice already. If we merge the docker container and look into some points here, then this is mergeable.

@@ -36,6 +37,12 @@ int main(int argc, char** argv) {
Ikarus::LinearElasticity lin(Ikarus::toLamesFirstParameterAndShearModulus(parameter));
return Ikarus::linearElastic(lin);
};
#if ENABLE_MUESLI
auto linearElasticFunc3D_Muesli = [](const Ikarus::YoungsModulusAndPoissonsRatio& parameter) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this test here neccesary?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New request to enhance existing features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants