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

Open
wants to merge 20 commits into
base: master
Choose a base branch
from

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
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