From 453eb538f75d95a7f5b2eb488584a3ecbcae6ef1 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Wed, 3 Apr 2019 16:24:15 +0000 Subject: [PATCH] preparing for PGI compiler --- src/CMakeLists.txt | 4 ++++ src/Lambert.f90 | 1 + src/crystallite.f90 | 7 +++--- src/future.f90 | 46 ++++++++++++++++++++++++++++++++++++++++ src/lattice.f90 | 1 + src/math.f90 | 1 + src/mesh_base.f90 | 13 ++++++------ src/plastic_nonlocal.f90 | 3 ++- src/quaternions.f90 | 1 + 9 files changed, 67 insertions(+), 10 deletions(-) create mode 100644 src/future.f90 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ddcf5972b..2b4fa8f31 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -36,6 +36,10 @@ add_library(IO OBJECT "IO.f90") add_dependencies(IO DAMASK_INTERFACE) list(APPEND OBJECTFILES $) +add_library(FUTURE OBJECT "future.f90") +add_dependencies(FUTURE IO) +list(APPEND OBJECTFILES $) + add_library(NUMERICS OBJECT "numerics.f90") add_dependencies(NUMERICS IO) list(APPEND OBJECTFILES $) diff --git a/src/Lambert.f90 b/src/Lambert.f90 index c570a600e..40bd04a01 100644 --- a/src/Lambert.f90 +++ b/src/Lambert.f90 @@ -42,6 +42,7 @@ module Lambert pReal use math, only: & PI + use future implicit none private diff --git a/src/crystallite.f90 b/src/crystallite.f90 index f45567d1a..b234d133d 100644 --- a/src/crystallite.f90 +++ b/src/crystallite.f90 @@ -18,6 +18,7 @@ module crystallite FEsolving_execIP use material, only: & homogenization_Ngrains + use future implicit none @@ -352,7 +353,7 @@ subroutine crystallite_init crystallite_F0(1:3,1:3,c,i,e) = math_I3 crystallite_localPlasticity(c,i,e) = phase_localPlasticity(material_phase(c,i,e)) crystallite_Fe(1:3,1:3,c,i,e) = math_inv33(matmul(crystallite_Fi0(1:3,1:3,c,i,e), & - crystallite_Fp0(1:3,1:3,c,i,e))) ! assuming that euler angles are given in internal strain free configuration + crystallite_Fp0(1:3,1:3,c,i,e))) ! assuming that euler angles are given in internal strain free configuration crystallite_Fp(1:3,1:3,c,i,e) = crystallite_Fp0(1:3,1:3,c,i,e) crystallite_Fi(1:3,1:3,c,i,e) = crystallite_Fi0(1:3,1:3,c,i,e) crystallite_requested(c,i,e) = .true. @@ -600,8 +601,8 @@ function crystallite_stress(dummyArgumentToPreventInternalCompilerErrorWithGCC) + crystallite_subStep(c,i,e) * (crystallite_partionedF (1:3,1:3,c,i,e) & - crystallite_partionedF0(1:3,1:3,c,i,e)) crystallite_Fe(1:3,1:3,c,i,e) = matmul(matmul(crystallite_subF (1:3,1:3,c,i,e), & - crystallite_invFp(1:3,1:3,c,i,e)), & - crystallite_invFi(1:3,1:3,c,i,e)) + crystallite_invFp(1:3,1:3,c,i,e)), & + crystallite_invFi(1:3,1:3,c,i,e)) crystallite_subdt(c,i,e) = crystallite_subStep(c,i,e) * crystallite_dt(c,i,e) crystallite_converged(c,i,e) = .false. endif diff --git a/src/future.f90 b/src/future.f90 new file mode 100644 index 000000000..de11a2e94 --- /dev/null +++ b/src/future.f90 @@ -0,0 +1,46 @@ +!-------------------------------------------------------------------------------------------------- +!> @author Martin Diehl, Max-Planck-Institut für Eisenforschung GmbH +!> @brief New fortran functions for compiler versions that do not support them +!-------------------------------------------------------------------------------------------------- +module future + public +contains + +#if defined(__GFORTRAN__) || __INTEL_COMPILER < 1800 +!-------------------------------------------------------------------------------------------------- +!> @brief substitute for the findloc intrinsic (only for integer, dimension(:) at the moment) +!-------------------------------------------------------------------------------------------------- +function findloc(a,v) + integer, intent(in), dimension(:) :: a + integer, intent(in) :: v + integer :: i,j + integer, allocatable, dimension(:) :: findloc + + allocate(findloc(count(a==v))) + j = 1 + do i = 1, size(a) + if (a(i)==v) then + findloc(j) = i + j = j + 1 + endif + enddo +end function findloc +#endif + +#if defined(__PGI) +!-------------------------------------------------------------------------------------------------- +!> @brief substitute for the norm2 intrinsic (only for real,dimension(3) at the moment) +!-------------------------------------------------------------------------------------------------- +real(pReal) pure function norm2(v) + use prec, only: & + pReal + + implicit none + real(pReal), intent(in), dimension(3) :: v + + norm2 = sqrt(sum(v**2)) + +end function norm2 +#endif + +end module future diff --git a/src/lattice.f90 b/src/lattice.f90 index 6c5a709e4..1b844c31f 100644 --- a/src/lattice.f90 +++ b/src/lattice.f90 @@ -9,6 +9,7 @@ module lattice use prec, only: & pReal + use future implicit none private diff --git a/src/math.f90 b/src/math.f90 index 5e6f17a87..3338b99e3 100644 --- a/src/math.f90 +++ b/src/math.f90 @@ -8,6 +8,7 @@ module math use prec, only: & pReal + use future implicit none private diff --git a/src/mesh_base.f90 b/src/mesh_base.f90 index 5afdbc3ad..fae228bc0 100644 --- a/src/mesh_base.f90 +++ b/src/mesh_base.f90 @@ -8,13 +8,14 @@ !-------------------------------------------------------------------------------------------------- module mesh_base - use, intrinsic :: iso_c_binding - use prec, only: & - pStringLen, & - pReal, & - pInt - use element, only: & + use, intrinsic :: iso_c_binding + use prec, only: & + pStringLen, & + pReal, & + pInt + use element, only: & tElement + use future implicit none diff --git a/src/plastic_nonlocal.f90 b/src/plastic_nonlocal.f90 index 94f0fde04..f5f48ed11 100644 --- a/src/plastic_nonlocal.f90 +++ b/src/plastic_nonlocal.f90 @@ -7,7 +7,8 @@ module plastic_nonlocal use prec, only: & pReal - + use future + implicit none private real(pReal), parameter, private :: & diff --git a/src/quaternions.f90 b/src/quaternions.f90 index 39dc1d3cd..2716817cf 100644 --- a/src/quaternions.f90 +++ b/src/quaternions.f90 @@ -36,6 +36,7 @@ module quaternions use prec, only: & pReal + use future implicit none public