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

645 tfel material add eshelby tensor in anisotropic medium #649

Merged

Conversation

antoinecea
Copy link
Collaborator

eshelby and hill tensor of a 3d ellipsoid embedded in an anisotropic matrix
included : tests which show that when the matrix is isotropic, the computation coincides with the formulas already available for isotropic case
But it would be great to compare with other libraries

@antoinecea antoinecea linked an issue Dec 3, 2024 that may be closed by this pull request
@antoinecea antoinecea requested a review from thelfer December 3, 2024 14:41
@thelfer
Copy link
Owner

thelfer commented Dec 3, 2024

Could you update the documentation and the release notes ?

@thelfer
Copy link
Owner

thelfer commented Dec 3, 2024

setST2toST2Component, getStensorComponent could be defined in TFEL/Math. Indeed, I am surprised that something similar does not exist

@thelfer
Copy link
Owner

thelfer commented Dec 3, 2024

Do not hesitate to use the format.sh script (merge with master before doing it)

include/TFEL/Material/EshelbyAnisotropic.hxx Outdated Show resolved Hide resolved
Comment on lines 503 to 506
install_header(TFEL/Material Eshelby.hxx)
install_header(TFEL/Material Eshelby.ixx)
install_header(TFEL/Material EshelbyAnisotropic.hxx)
install_header(TFEL/Material EshelbyAnisotropic.ixx)
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
install_header(TFEL/Material Eshelby.hxx)
install_header(TFEL/Material Eshelby.ixx)
install_header(TFEL/Material EshelbyAnisotropic.hxx)
install_header(TFEL/Material EshelbyAnisotropic.ixx)
install_header(TFEL/Material IsotropicEshelbyLinearHomogeneization.hxx)
install_header(TFEL/Material IsotropicEshelbyLinearHomogeneization.ixx)
install_header(TFEL/Material AnisotropicEshelbyLinearHomogeneization.hxx)
install_header(TFEL/Material AnisotropicEshelbyLinearHomogeneization.ixx)

include/TFEL/Material/EshelbyAnisotropic.ixx Outdated Show resolved Hide resolved
@@ -14,6 +14,7 @@ endmacro(tests_material)
tests_material(EshelbyBasedHomogenization)
tests_material(Eshelby)
tests_material(Lame)
tests_material(EshelbyAnisotropic)
Copy link
Owner

Choose a reason for hiding this comment

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

See previous proposal of renaming

Comment on lines 53 to 54
if (I > 2){fac/=std::sqrt(2);};
if (J > 2){fac/=std::sqrt(2);};
Copy link
Owner

Choose a reason for hiding this comment

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

You may want to use tfel::math::Cste or constants defined in std::numbers. For instance, 1/sqrt(2) is given by:

   constexpr auto icste = tfel::math::Cste<real>::isqrt2;

which can be used as follows:

Suggested change
if (I > 2){fac/=std::sqrt(2);};
if (J > 2){fac/=std::sqrt(2);};
if (I > 2){fac*=icste;};
if (J > 2){fac*=icste;};

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

Comment on lines 63 to 64
if (I > 2){fac*=std::sqrt(2);};
if (J > 2){fac*=std::sqrt(2);};
Copy link
Owner

Choose a reason for hiding this comment

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

See previous comment

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

include/TFEL/Material/EshelbyAnisotropic.ixx Outdated Show resolved Hide resolved
};

template<typename Type,typename real>
TFEL_HOST_DEVICE Type getStensor(const tfel::math::stensor<3u,Type>& A, int i, int j){
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
TFEL_HOST_DEVICE Type getStensor(const tfel::math::stensor<3u,Type>& A, int i, int j){
TFEL_HOST_DEVICE Type getStensorComponent(const tfel::math::stensor<3u,Type>& A, int i, int j){

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

};

template<typename Type,typename real>
TFEL_HOST_DEVICE void setStensor(tfel::math::stensor<3u,Type>& A, int i, int j,Type Aij){
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
TFEL_HOST_DEVICE void setStensor(tfel::math::stensor<3u,Type>& A, int i, int j,Type Aij){
TFEL_HOST_DEVICE void setStensorComponent(tfel::math::stensor<3u,Type>& A, int i, int j,Type Aij){

Copy link
Owner

Choose a reason for hiding this comment

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

In TFEL, we use unsigned short for indexing values in small objects. This is questionable, but this is how it is done.

Suggested change
TFEL_HOST_DEVICE void setStensor(tfel::math::stensor<3u,Type>& A, int i, int j,Type Aij){
TFEL_HOST_DEVICE void setStensorComponent(tfel::math::stensor<3u,Type>& A,
typename tfel::math::stensor<3u,Type>::size_type i,
typename tfel::math::stensor<3u,Type>::size_type j,
Type Aij){

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

};

template<typename Type,typename real>
TFEL_HOST_DEVICE void setSt4(tfel::math::st2tost2<3u,Type>& A, int i, int j, int k, int l,Type Aijkl){
Copy link
Owner

Choose a reason for hiding this comment

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

See the remark below for int.

Suggested change
TFEL_HOST_DEVICE void setSt4(tfel::math::st2tost2<3u,Type>& A, int i, int j, int k, int l,Type Aijkl){
TFEL_HOST_DEVICE void setST2toST2Component(tfel::math::st2tost2<3u,Type>& A, int i, int j, int k, int l,Type Aijkl){

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

@antoinecea antoinecea force-pushed the 645-tfel-material-add-eshelby-tensor-in-anisotropic-medium branch from ceaa660 to 60a2f3f Compare December 6, 2024 10:24
include/CMakeLists.txt Outdated Show resolved Hide resolved
TFEL_HOST_DEVICE static tfel::math::st2tost2<
2u,
typename tfel::math::invert_type<StressType>>
compute2DAnisotropicHillTensor(const tfel::math::st2tost2<2u, StressType>&,
Copy link
Owner

Choose a reason for hiding this comment

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

Maybe computePlainStrainAnisotropicHillTensor is better.

include/TFEL/Material/AnisotropicEshelbyTensor.hxx Outdated Show resolved Hide resolved
Comment on lines 32 to 35
* \param [in] n_a: direction of the principal axis whose length is
* \f$a\f$ \param [in] a: length of semi-axis relative to the direction
* \f$n_a\f$ \param [in] b: length of semi-axis relative to the other
* direction \param[in] max_it: maximal number of iterations for integration
Copy link
Owner

Choose a reason for hiding this comment

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

Documentation ?

tests/Material/AnisotropicEshelbyTensor.cxx Outdated Show resolved Hide resolved
Comment on lines 503 to 506
install_header(TFEL/Material Eshelby.hxx)
install_header(TFEL/Material Eshelby.ixx)
install_header(TFEL/Material EshelbyBasedHomogenization.ixx)
install_header(TFEL/Material EshelbyBasedHomogenization.hxx)
Copy link
Owner

Choose a reason for hiding this comment

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

For backward compatibility, please keep headers that were potentially used.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

@thelfer thelfer merged commit 23851fc into master Feb 5, 2025
2 checks passed
@antoinecea antoinecea deleted the 645-tfel-material-add-eshelby-tensor-in-anisotropic-medium branch February 7, 2025 08:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

tfel material add eshelby tensor in anisotropic medium
2 participants