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

Implement the rotation of the stiffness tensor from the local frame to the global frame (+ other fixes) #3

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

Conversation

jeanmichelscherer
Copy link

No description provided.

@bourdin
Copy link
Owner

bourdin commented Jul 26, 2022

Would you mind splitting this MR into smaller ones:

  1. changes to python scripts
  2. memory leak
  3. double contraction of tensor and bug fix in addition of 4th order tensor

Then, I am not sure to understand why you need both the rotation matrix , the Euler angles and the vectors.

@jeanmichelscherer
Copy link
Author

It seems that my newest commits have automatically been added to the MR, which is not what I wanted.
I will do new/smaller MRs for each part.

It is convenient to be able to give a rotation matrix either from vectors or angles.
The first option is particularly useful when you want to test a precise orientation, say the [111] axis of a crystal.
The second option is more useful for randomly generated or measured orientations.
From my experience, rotation matrices/angles are very error-prone. So, it seems to be a good idea to have all those transformations hard-coded and validated in vDef instead of letting each user make its own pre-processor.
Let me know if you would prefer to keep only one of the two options.

@bourdin
Copy link
Owner

bourdin commented Jul 26, 2022

It is convenient to be able to give a rotation matrix either from vectors or angles.
The first option is particularly useful when you want to test a precise orientation, say the [111] axis of a crystal.
The second option is more useful for randomly generated or measured orientations.
From my experience, rotation matrices/angles are very error-prone. So, it seems to be a good idea to have all those transformations hard-coded and validated in vDef instead of letting each user make its own pre-processor.
Let me know if you would prefer to keep only one of the two options.

Very good point. That is actually why I implemented isotropic Hooke's laws on top of full tensor

@bourdin
Copy link
Owner

bourdin commented Aug 15, 2022

Was everything in here included in the 3 PR I just merged?

@jeanmichelscherer
Copy link
Author

There are two commits I did not include in the smaller PRs:

  • Commit 9b44402 : In the Makefile.include, I have to add -I${SNLP_DIR}/obj in the FC_FLAGS and C_FLAGS.

  • Commit d64abaf : It implements the double contraction of two 4th order tensors. It might be useful for the Hydro-Dev split of a cubic elasticity behavior, which I've not really been using as of now. I have not checked if the double contraction implementation gives valid results yet.

@bourdin
Copy link
Owner

bourdin commented Aug 17, 2022

There are two commits I did not include in the smaller PRs:

  • Commit 9b44402 : In the Makefile.include, I have to add -I${SNLP_DIR}/obj in the FC_FLAGS and C_FLAGS.

THese should not be needed since we build a shared library

  • Commit d64abaf : It implements the double contraction of two 4th order tensors. It might be useful for the Hydro-Dev split of a cubic elasticity behavior, which I've not really been using as of now. I have not checked if the double contraction implementation gives valid results yet.

We can either merge these and print a message stating that this has not been tested, or build a test. Can we compare (AB)e and A(Be) for random A, B, and e, for instance?

@jeanmichelscherer
Copy link
Author

There are two commits I did not include in the smaller PRs:

  • Commit 9b44402 : In the Makefile.include, I have to add -I${SNLP_DIR}/obj in the FC_FLAGS and C_FLAGS.

THese should not be needed since we build a shared library

If not added, I get the following compilation error:

/home/scherer/Softwares/MEF90/mef90dev/m_DefMech/m_MEF90_DefMechPlasticity.F90:1026:10:

 1026 |       use SNLPF90
      |          1
Fatal Error: Cannot open module file ‘snlpf90.mod’ for reading at (1): No such file or directory
compilation terminated.
  • Commit d64abaf : It implements the double contraction of two 4th order tensors. It might be useful for the Hydro-Dev split of a cubic elasticity behavior, which I've not really been using as of now. I have not checked if the double contraction implementation gives valid results yet.

We can either merge these and print a message stating that this has not been tested, or build a test. Can we compare (AB)e and A(Be) for random A, B, and e, for instance?

I will work on building a test and add it to a new PR.

In addition, I forgot to mention that I get the following compilation error from MEF90/m_MEF90_EXO.F90:

/home/scherer/Softwares/MEF90/mef90dev/MEF90/m_MEF90_EXO.F90:350:51:

  350 |          Call MPI_Bcast(EXOelemType,MXSTLN,MPI_CHAR,0,MEF90Ctx%comm,ierr)
      |                                                   1
Error: Symbol ‘mpi_char’ at (1) has no IMPLICIT type

That error can be solved by replacing MPI_CHAR with MPI_CHARACTER. This was also included in my original (big) PR but not in the smaller ones.

@bourdin
Copy link
Owner

bourdin commented Aug 17, 2022

There are two commits I did not include in the smaller PRs:

  • Commit 9b44402 : In the Makefile.include, I have to add -I${SNLP_DIR}/obj in the FC_FLAGS and C_FLAGS.

THese should not be needed since we build a shared library

If not added, I get the following compilation error:

/home/scherer/Softwares/MEF90/mef90dev/m_DefMech/m_MEF90_DefMechPlasticity.F90:1026:10:

 1026 |       use SNLPF90
      |          1
Fatal Error: Cannot open module file ‘snlpf90.mod’ for reading at (1): No such file or directory
compilation terminated.

This makes no sense what is $SNLP_DIR and what's in this directory?
in $MEF90_DIR/Makefile.include:

ifneq (${SNLP_DIR},)
	FC_FLAGS+= -DMEF90_HAVE_SNLP -I${SNLP_DIR}/include
	C_FLAGS+= -I${SNLP_DIR}/include
	SNLP_LIB:= -L${SNLP_DIR}/lib -lsnlp -lsnlpF90 -Wl,-rpath,${SNLP_DIR}/lib
endif

also, what gives make -C $MEF90_DIR/Tests debug?

  • Commit d64abaf : It implements the double contraction of two 4th order tensors. It might be useful for the Hydro-Dev split of a cubic elasticity behavior, which I've not really been using as of now. I have not checked if the double contraction implementation gives valid results yet.

We can either merge these and print a message stating that this has not been tested, or build a test. Can we compare (AB)e and A(Be) for random A, B, and e, for instance?

I will work on building a test and add it to a new PR.

In addition, I forgot to mention that I get the following compilation error from MEF90/m_MEF90_EXO.F90:

/home/scherer/Softwares/MEF90/mef90dev/MEF90/m_MEF90_EXO.F90:350:51:

  350 |          Call MPI_Bcast(EXOelemType,MXSTLN,MPI_CHAR,0,MEF90Ctx%comm,ierr)
      |                                                   1
Error: Symbol ‘mpi_char’ at (1) has no IMPLICIT type

That error can be solved by replacing MPI_CHAR with MPI_CHARACTER. This was also included in my original (big) PR but not in the smaller ones.

done

@jeanmichelscherer
Copy link
Author

There are two commits I did not include in the smaller PRs:

  • Commit 9b44402 : In the Makefile.include, I have to add -I${SNLP_DIR}/obj in the FC_FLAGS and C_FLAGS.

THese should not be needed since we build a shared library

If not added, I get the following compilation error:

/home/scherer/Softwares/MEF90/mef90dev/m_DefMech/m_MEF90_DefMechPlasticity.F90:1026:10:

 1026 |       use SNLPF90
      |          1
Fatal Error: Cannot open module file ‘snlpf90.mod’ for reading at (1): No such file or directory
compilation terminated.

This makes no sense what is $SNLP_DIR and what's in this directory?
in $MEF90_DIR/Makefile.include:

ifneq (${SNLP_DIR},)
	FC_FLAGS+= -DMEF90_HAVE_SNLP -I${SNLP_DIR}/include
	C_FLAGS+= -I${SNLP_DIR}/include
	SNLP_LIB:= -L${SNLP_DIR}/lib -lsnlp -lsnlpF90 -Wl,-rpath,${SNLP_DIR}/lib
endif

$SNLP_DIR points to where I installed SNLP: /home/scherer/Softwares/MEF90/snlp. It containes obj, lib, include,src, etc for SNLP.

also, what gives make -C $MEF90_DIR/Tests debug?

This line returns the following:

scherer@pasadena:~/Softwares/MEF90/mef90dev$ make -C $MEF90_DIR/Tests debug
make: Entering directory '/home/scherer/Softwares/MEF90/mef90dev/Tests'
FFLAGS
FC_FLAGS -ffree-line-length-none -fPIC -O3 -march=cascadelake -march=westmere -g -DMEF90_HAVE_SNLP
FCFLAGS
FCPPFLAGS -I/home/scherer/Softwares/MEF90/petsc-3.3-mef90/include -I/home/scherer/Softwares/MEF90/petsc-3.3-mef90/arch-linux2-cxx-opt/include -I/home/scherer/Softwares/MEF90/petsc-3.3-mef90/include/sieve
FCPP_FLAGS
LDFLAGS
CLINKER /home/scherer/Softwares/MEF90/petsc-3.3-mef90/arch-linux2-cxx-opt/bin/mpic++ -Wall -Wwrite-strings -Wno-strict-aliasing -Wno-unknown-pragmas -O3 -march=cascadelake -march=westmere -g
FLINKER /home/scherer/Softwares/MEF90/petsc-3.3-mef90/arch-linux2-cxx-opt/bin/mpif90 -ffree-line-length-none -fPIC -O3 -march=cascadelake -march=westmere -g
PETSC_LIB -Wl,-rpath,/home/scherer/Softwares/MEF90/petsc-3.3-mef90/arch-linux2-cxx-opt/lib -L/home/scherer/Softwares/MEF90/petsc-3.3-mef90/arch-linux2-cxx-opt/lib -lpetsc -Wl,-rpath,/home/scherer/Softwares/MEF90/petsc-3.3-mef90/arch-linux2-cxx-opt/lib -ltriangle -lX11 -lyaml -lpthread -lparmetis -lmetis -lexoIIv2for32 -lexodus -lml -lHYPRE -lchaco -lf2clapack -lf2cblas -lm -lnetcdf -lm -Wl,-rpath,/usr/lib/gcc/x86_64-linux-gnu/9 -L/usr/lib/gcc/x86_64-linux-gnu/9 -Wl,-rpath,/usr/lib/x86_64-linux-gnu -L/usr/lib/x86_64-linux-gnu -Wl,-rpath,/lib/x86_64-linux-gnu -L/lib/x86_64-linux-gnu -lmpi_f90 -lmpi_f77 -lgfortran -lm -lgfortran -lm -lgfortran -lm -lm -lquadmath -lm -lmpi_cxx -lstdc++ -ldl -lmpi -lopen-rte -lopen-pal -lnsl -lutil -lgcc_s -lpthread -ldl
make: Leaving directory '/home/scherer/Softwares/MEF90/mef90dev/Tests'

@bourdin
Copy link
Owner

bourdin commented Aug 17, 2022

This line returns the following:

scherer@pasadena:~/Softwares/MEF90/mef90dev$ make -C $MEF90_DIR/Tests debug
make: Entering directory '/home/scherer/Softwares/MEF90/mef90dev/Tests'
FFLAGS
FC_FLAGS -ffree-line-length-none -fPIC -O3 -march=cascadelake -march=westmere -g -DMEF90_HAVE_SNLP
FCFLAGS
FCPPFLAGS -I/home/scherer/Softwares/MEF90/petsc-3.3-mef90/include -I/home/scherer/Softwares/MEF90/petsc-3.3-mef90/arch-linux2-cxx-opt/include -I/home/scherer/Softwares/MEF90/petsc-3.3-mef90/include/sieve
FCPP_FLAGS
LDFLAGS
CLINKER /home/scherer/Softwares/MEF90/petsc-3.3-mef90/arch-linux2-cxx-opt/bin/mpic++ -Wall -Wwrite-strings -Wno-strict-aliasing -Wno-unknown-pragmas -O3 -march=cascadelake -march=westmere -g
FLINKER /home/scherer/Softwares/MEF90/petsc-3.3-mef90/arch-linux2-cxx-opt/bin/mpif90 -ffree-line-length-none -fPIC -O3 -march=cascadelake -march=westmere -g
PETSC_LIB -Wl,-rpath,/home/scherer/Softwares/MEF90/petsc-3.3-mef90/arch-linux2-cxx-opt/lib -L/home/scherer/Softwares/MEF90/petsc-3.3-mef90/arch-linux2-cxx-opt/lib -lpetsc -Wl,-rpath,/home/scherer/Softwares/MEF90/petsc-3.3-mef90/arch-linux2-cxx-opt/lib -ltriangle -lX11 -lyaml -lpthread -lparmetis -lmetis -lexoIIv2for32 -lexodus -lml -lHYPRE -lchaco -lf2clapack -lf2cblas -lm -lnetcdf -lm -Wl,-rpath,/usr/lib/gcc/x86_64-linux-gnu/9 -L/usr/lib/gcc/x86_64-linux-gnu/9 -Wl,-rpath,/usr/lib/x86_64-linux-gnu -L/usr/lib/x86_64-linux-gnu -Wl,-rpath,/lib/x86_64-linux-gnu -L/lib/x86_64-linux-gnu -lmpi_f90 -lmpi_f77 -lgfortran -lm -lgfortran -lm -lgfortran -lm -lm -lquadmath -lm -lmpi_cxx -lstdc++ -ldl -lmpi -lopen-rte -lopen-pal -lnsl -lutil -lgcc_s -lpthread -ldl
make: Leaving directory '/home/scherer/Softwares/MEF90/mef90dev/Tests'

That is inconsistent with Makefile.include Are you sure that you did not modify any of the makefiles? I don't see how you could get -DMEF90_HAVE_SNLP without -I${SNLP_DIR}/include

@jeanmichelscherer
Copy link
Author

That is inconsistent with Makefile.include Are you sure that you did not modify any of the makefiles? I don't see how you could get -DMEF90_HAVE_SNLP without -I${SNLP_DIR}/include

Yes my bad, I removed both -I${SNLP_DIR}/include and -I${SNLP_DIR}/obj from the flags instead of only the latter.
Running make -C $MEF90_DIR/Tests debug outputs the following:

scherer@pasadena:~/Softwares/MEF90/mef90dev$ make -C $MEF90_DIR/Tests debug
make: Entering directory '/home/scherer/Softwares/MEF90/mef90dev/Tests'
FFLAGS
FC_FLAGS -ffree-line-length-none -fPIC -O3 -march=cascadelake -march=westmere -g -DMEF90_HAVE_SNLP -I/home/scherer/Softwares/MEF90/snlp/include
FCFLAGS
FCPPFLAGS -I/home/scherer/Softwares/MEF90/petsc-3.3-mef90/include -I/home/scherer/Softwares/MEF90/petsc-3.3-mef90/arch-linux2-cxx-opt/include -I/home/scherer/Softwares/MEF90/petsc-3.3-mef90/include/sieve
FCPP_FLAGS
LDFLAGS
CLINKER /home/scherer/Softwares/MEF90/petsc-3.3-mef90/arch-linux2-cxx-opt/bin/mpic++ -Wall -Wwrite-strings -Wno-strict-aliasing -Wno-unknown-pragmas -O3 -march=cascadelake -march=westmere -g
FLINKER /home/scherer/Softwares/MEF90/petsc-3.3-mef90/arch-linux2-cxx-opt/bin/mpif90 -ffree-line-length-none -fPIC -O3 -march=cascadelake -march=westmere -g
PETSC_LIB -Wl,-rpath,/home/scherer/Softwares/MEF90/petsc-3.3-mef90/arch-linux2-cxx-opt/lib -L/home/scherer/Softwares/MEF90/petsc-3.3-mef90/arch-linux2-cxx-opt/lib -lpetsc -Wl,-rpath,/home/scherer/Softwares/MEF90/petsc-3.3-mef90/arch-linux2-cxx-opt/lib -ltriangle -lX11 -lyaml -lpthread -lparmetis -lmetis -lexoIIv2for32 -lexodus -lml -lHYPRE -lchaco -lf2clapack -lf2cblas -lm -lnetcdf -lm -Wl,-rpath,/usr/lib/gcc/x86_64-linux-gnu/9 -L/usr/lib/gcc/x86_64-linux-gnu/9 -Wl,-rpath,/usr/lib/x86_64-linux-gnu -L/usr/lib/x86_64-linux-gnu -Wl,-rpath,/lib/x86_64-linux-gnu -L/lib/x86_64-linux-gnu -lmpi_f90 -lmpi_f77 -lgfortran -lm -lgfortran -lm -lgfortran -lm -lm -lquadmath -lm -lmpi_cxx -lstdc++ -ldl -lmpi -lopen-rte -lopen-pal -lnsl -lutil -lgcc_s -lpthread -ldl
make: Leaving directory '/home/scherer/Softwares/MEF90/mef90dev/Tests'

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.

None yet

2 participants