From f0b4281400b355c75dfd6a9a5e273d573e2020e3 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Mon, 11 Feb 2013 10:43:45 +0000 Subject: [PATCH] removed unused variables, added pure statements, and declared external functions as external (using gfortrans debug option) --- code/constitutive.f90 | 2 +- code/constitutive_dislotwin.f90 | 4 ++-- code/constitutive_j2.f90 | 4 ++-- code/constitutive_nonlocal.f90 | 11 ++++------- code/constitutive_phenopowerlaw.f90 | 10 +++++----- code/crystallite.f90 | 1 + code/mesh.f90 | 11 +++++++---- 7 files changed, 22 insertions(+), 21 deletions(-) diff --git a/code/constitutive.f90 b/code/constitutive.f90 index ac431879a..9f48535d5 100644 --- a/code/constitutive.f90 +++ b/code/constitutive.f90 @@ -1102,4 +1102,4 @@ function constitutive_postResults(Tstar_v, Fe, Temperature, dt, g, i, e) end function constitutive_postResults -end module constitutive \ No newline at end of file +end module constitutive diff --git a/code/constitutive_dislotwin.f90 b/code/constitutive_dislotwin.f90 index 8e2e2b6ef..a398e00bd 100644 --- a/code/constitutive_dislotwin.f90 +++ b/code/constitutive_dislotwin.f90 @@ -139,7 +139,7 @@ integer(pInt), intent(in) :: file !* Local variables integer(pInt), parameter :: maxNchunks = 21_pInt integer(pInt), dimension(1+2*maxNchunks) :: positions -integer(pInt) :: section, maxNinstance,mySize,myStructure,maxTotalNslip,maxTotalNtwin,& +integer(pInt) :: section, maxNinstance,mySize=0_pInt,myStructure,maxTotalNslip,maxTotalNtwin,& f,i,j,k,l,m,n,o,p,q,r,s,ns,nt, & index_myFamily, index_otherFamily character(len=64) tag @@ -1509,7 +1509,7 @@ do o = 1_pInt,phase_Noutput(material_phase(g,ip,el)) constitutive_dislotwin_postResults(c+j) = dot_product(Tstar_v, constitutive_dislotwin_sbSv(1:6,j,g,ip,el)) enddo c = c + 6_pInt - case ('schmid_factor_shearband') + case ('schmid_factor_shearband') !ToDo: j has no value!!!!!! constitutive_dislotwin_postResults(c+1_pInt:c+6_pInt) = constitutive_dislotwin_sbSv(1:6,j,g,ip,el) c = c + 6_pInt case ('shear_rate_shearband') diff --git a/code/constitutive_j2.f90 b/code/constitutive_j2.f90 index ba9130dba..ce2c4ecce 100644 --- a/code/constitutive_j2.f90 +++ b/code/constitutive_j2.f90 @@ -129,7 +129,7 @@ subroutine constitutive_j2_init(myFile) integer(pInt), parameter :: maxNchunks = 7_pInt integer(pInt), dimension(1_pInt+2_pInt*maxNchunks) :: positions - integer(pInt) :: section = 0_pInt, maxNinstance, i,j,k,o, mySize + integer(pInt) :: section = 0_pInt, maxNinstance, i,o, mySize character(len=64) :: tag character(len=1024) :: line = '' ! to start initialized @@ -371,7 +371,7 @@ pure function constitutive_j2_homogenizedC(state,ipc,ip,el) end function constitutive_j2_homogenizedC -subroutine constitutive_j2_microstructure(Temperature,state,ipc,ip,el) +pure subroutine constitutive_j2_microstructure(Temperature,state,ipc,ip,el) !********************************************************************* !* calculate derived quantities from state (not used here) * !* INPUT: * diff --git a/code/constitutive_nonlocal.f90 b/code/constitutive_nonlocal.f90 index b466ac805..23b373b48 100644 --- a/code/constitutive_nonlocal.f90 +++ b/code/constitutive_nonlocal.f90 @@ -249,14 +249,12 @@ integer(pInt), intent(in) :: myFile integer(pInt), parameter :: maxNchunks = 21_pInt integer(pInt), & dimension(1_pInt+2_pInt*maxNchunks) :: positions -integer(pInt) section, & +integer(pInt) :: section, & maxNinstance, & maxTotalNslip, & myStructure, & f, & ! index of my slip family i, & ! index of my instance of this plasticity - j, & - k, & l, & ns, & ! short notation for total number of active slip systems for the current instance o, & ! index of my output @@ -264,7 +262,7 @@ integer(pInt) section, & s1, & ! index of my slip system s2, & ! index of my slip system it, & ! index of my interaction type - mySize + mySize = 0_pInt ! to suppress warnings, safe as init is called only once character(len=64) tag character(len=1024) :: line = '' ! to start initialized @@ -970,7 +968,6 @@ real(pReal), dimension(:), allocatable :: & rhoDipScrew ! screw dipole dislocation density integer(pInt) el, & ip, & - g, & ns, & ! short notation for total number of active slip systems f, & ! index of lattice family from, & @@ -1498,9 +1495,9 @@ real(pReal), dimension(constitutive_nonlocal_totalNslip(phase_plasticityInstance intent(out), optional :: dv_dtau ! velocity derivative with respect to resolved shear stress !*** local variables -integer(pInt) instance, & ! current instance of this plasticity +integer(pInt) :: instance, & ! current instance of this plasticity ns, & ! short notation for the total number of active slip systems - s, t ! index of my current slip system + s ! index of my current slip system real(pReal), dimension(constitutive_nonlocal_totalNslip(phase_plasticityInstance(material_phase(g,ip,el)))) :: & tauThreshold, & ! threshold shear stress tauEff ! effective shear stress diff --git a/code/constitutive_phenopowerlaw.f90 b/code/constitutive_phenopowerlaw.f90 index f878b9a13..bec4caf86 100644 --- a/code/constitutive_phenopowerlaw.f90 +++ b/code/constitutive_phenopowerlaw.f90 @@ -131,10 +131,10 @@ subroutine constitutive_phenopowerlaw_init(myFile) integer(pInt), intent(in) :: myFile integer(pInt), parameter :: maxNchunks = lattice_maxNinteraction + 1_pInt integer(pInt), dimension(1+2*maxNchunks) :: positions - integer(pInt) section, maxNinstance, i,j,k, f,o, & - Nchunks_SlipSlip, Nchunks_SlipTwin, Nchunks_TwinSlip, Nchunks_TwinTwin, & - Nchunks_SlipFamilies, Nchunks_TwinFamilies, & - mySize, myStructure, index_myFamily, index_otherFamily + integer(pInt) :: section, maxNinstance, i,j,k, f,o, & + Nchunks_SlipSlip, Nchunks_SlipTwin, Nchunks_TwinSlip, Nchunks_TwinTwin, & + Nchunks_SlipFamilies, Nchunks_TwinFamilies, & + mySize=0_pInt, myStructure, index_myFamily, index_otherFamily character(len=64) :: tag character(len=1024) :: line = '' ! to start initialized @@ -639,7 +639,7 @@ end function constitutive_phenopowerlaw_homogenizedC !-------------------------------------------------------------------------------------------------- !> @brief calculate derived quantities from state (dummy subroutine, not used here) !-------------------------------------------------------------------------------------------------- -subroutine constitutive_phenopowerlaw_microstructure(Temperature,state,ipc,ip,el) +pure subroutine constitutive_phenopowerlaw_microstructure(Temperature,state,ipc,ip,el) use prec, only: pReal,pInt,p_vec use mesh, only: mesh_NcpElems,mesh_maxNips diff --git a/code/crystallite.f90 b/code/crystallite.f90 index 3dd092f0f..703d297e3 100644 --- a/code/crystallite.f90 +++ b/code/crystallite.f90 @@ -42,6 +42,7 @@ module crystallite crystallite_integrateStateRKCK45, & crystallite_integrateStress, & crystallite_stateJump + external :: dgesv ! **************************************************************** ! *** General variables for the crystallite calculation *** diff --git a/code/mesh.f90 b/code/mesh.f90 index 633eb1fd7..165088212 100644 --- a/code/mesh.f90 +++ b/code/mesh.f90 @@ -802,6 +802,7 @@ function mesh_spectral_getResolution(fileUnit) logical :: gotResolution = .false. integer(pInt) :: myUnit + mesh_spectral_getResolution = -1_pInt if(.not. present(fileUnit)) then myUnit = 289_pInt call IO_open_file(myUnit,trim(geometryFile)) @@ -883,6 +884,7 @@ function mesh_spectral_getDimension(fileUnit) logical :: gotDimension = .false. integer(pInt) :: myUnit + mesh_spectral_getDimension = -1.0_pReal if(.not. present(fileUnit)) then myUnit = 289_pInt call IO_open_file(myUnit,trim(geometryFile)) @@ -957,6 +959,7 @@ function mesh_spectral_getHomogenization(fileUnit) logical :: gotHomogenization = .false. integer(pInt) :: myUnit + mesh_spectral_getHomogenization = -1_pInt if(.not. present(fileUnit)) then myUnit = 289_pInt call IO_open_file(myUnit,trim(geometryFile)) @@ -1976,18 +1979,18 @@ function mesh_deformedCoordsFFT(gDim,F,scalingIn,FavgIn) result(coords) do k = 1_pInt, iRes(3); do j = 1_pInt, iRes(2); do i = 1_pInt, iRes(1) - F_real(i,j,k,1:3,1:3) = F(1:3,1:3,i,j,k) ! ensure that data is aligned properly (fftw_alloc) + F_real(i,j,k,1:3,1:3) = F(1:3,1:3,i,j,k) ! ensure that data is aligned properly (fftw_alloc) enddo; enddo; enddo call fftw_execute_dft_r2c(fftw_forth, F_real, F_fourier) if (present(FavgIn)) then if (all(FavgIn < 0.0_pReal)) then - Favg = real(F_fourier(1,1,1,1:3,1:3)*real(product(iRes),pReal),pReal) !the f2py way to tell it is not present + Favg = real(F_fourier(1,1,1,1:3,1:3),pReal)*real(product(iRes),pReal) !the f2py way to tell it is not present else Favg = FavgIn endif else - Favg = real(F_fourier(1,1,1,1:3,1:3)*real(product(iRes),pReal),pReal) + Favg = real(F_fourier(1,1,1,1:3,1:3),pReal)*real(product(iRes),pReal) endif !remove highest frequency in each direction @@ -2014,7 +2017,7 @@ function mesh_deformedCoordsFFT(gDim,F,scalingIn,FavgIn) result(coords) coords_fourier(i,j,k,m) = sum(F_fourier(i,j,k,m,1:3)*cmplx(0.0_pReal,real(k_s,pReal)*integrator,pReal)) enddo if (k_s(3) /= 0_pInt .or. k_s(2) /= 0_pInt .or. k_s(1) /= 0_pInt) & - coords_fourier(i,j,k,1:3) = coords_fourier(i,j,k,1:3) / real(-sum(k_s*k_s),pReal) + coords_fourier(i,j,k,1:3) = coords_fourier(i,j,k,1:3) / cmplx(-sum(k_s*k_s),0.0_pReal,pReal) enddo; enddo; enddo call fftw_execute_dft_c2r(fftw_back,coords_fourier,coords_real)