From ba89df7784ffaf60b8aec1655bfb7ed4d4b34ece Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Mon, 16 Dec 2013 11:58:03 +0000 Subject: [PATCH] continued with sourced allocation and EOL improvements --- code/DAMASK_spectral_driver.f90 | 9 +++--- code/DAMASK_spectral_utilities.f90 | 6 ++-- code/homogenization.f90 | 49 +++++++++++------------------- 3 files changed, 25 insertions(+), 39 deletions(-) diff --git a/code/DAMASK_spectral_driver.f90 b/code/DAMASK_spectral_driver.f90 index 357ef812b..91c3c0132 100644 --- a/code/DAMASK_spectral_driver.f90 +++ b/code/DAMASK_spectral_driver.f90 @@ -52,7 +52,8 @@ program DAMASK_spectral_Driver IO_lc, & IO_intOut, & IO_warning, & - IO_timeStamp + IO_timeStamp, & + IO_EOF use debug, only: & debug_level, & debug_spectral, & @@ -110,7 +111,7 @@ program DAMASK_spectral_Driver integer(pInt), parameter :: maxNchunks = (1_pInt + 9_pInt)*3_pInt + & ! deformation, rotation, and stress (1_pInt + 1_pInt)*5_pInt + & ! time, (log)incs, temp, restartfrequency, and outputfrequency 1_pInt, & ! dropguessing - FILEUNIT = 234_pInt !< file unit, DAMASK IO does not support newunit feature + FILEUNIT = 234_pInt !< file unit, DAMASK IO does not support newunit feature integer(pInt), dimension(1_pInt + maxNchunks*2_pInt) :: positions ! this is longer than needed for geometry parsing integer(pInt) :: & @@ -169,7 +170,7 @@ program DAMASK_spectral_Driver rewind(FILEUNIT) do line = IO_read(FILEUNIT) - if (trim(line) == '#EOF#') exit + if (trim(line) == IO_EOF) exit if (IO_isBlank(line)) cycle ! skip empty lines positions = IO_stringPos(line,maxNchunks) do i = 1_pInt, positions(1) ! reading compulsory parameters for loadcase @@ -194,7 +195,7 @@ program DAMASK_spectral_Driver rewind(FILEUNIT) do line = IO_read(FILEUNIT) - if (trim(line) == '#EOF#') exit + if (trim(line) == IO_EOF) exit if (IO_isBlank(line)) cycle ! skip empty lines currentLoadCase = currentLoadCase + 1_pInt positions = IO_stringPos(line,maxNchunks) diff --git a/code/DAMASK_spectral_utilities.f90 b/code/DAMASK_spectral_utilities.f90 index 5ce3e6ec4..eab515c75 100644 --- a/code/DAMASK_spectral_utilities.f90 +++ b/code/DAMASK_spectral_utilities.f90 @@ -247,11 +247,11 @@ subroutine utilities_init() ! allocation allocate (xi(3,grid1Red,grid(2),grid(3)),source = 0.0_pReal) ! frequencies, only half the size for first dimension tensorField = fftw_alloc_complex(int(grid1Red*grid(2)*grid(3)*9_pInt,C_SIZE_T)) ! allocate aligned data using a C function, C_SIZE_T is of type integer(8) - phaseFieldFFT = fftw_alloc_complex(int(grid1Red*grid(2)*grid(3),C_SIZE_T)) ! allocate aligned data using a C function, C_SIZE_T is of type integer(8) + phaseFieldFFT = fftw_alloc_complex(int(grid1Red*grid(2)*grid(3),C_SIZE_T)) ! allocate aligned data using a C function, C_SIZE_T is of type integer(8) call c_f_pointer(tensorField, field_real, [grid(1)+2_pInt-mod(grid(1),2_pInt),grid(2),grid(3),3,3])! place a pointer for a real representation on tensorField call c_f_pointer(tensorField, field_fourier,[grid1Red, grid(2),grid(3),3,3])! place a pointer for a complex representation on tensorField call c_f_pointer(phaseFieldFFT,phaseField_real,[grid(1)+2_pInt-mod(grid(1),2_pInt),grid(2),grid(3)])! place a pointer for a real representation on tensorField - call c_f_pointer(phaseFieldFFT,phaseField_fourier,[grid1Red,grid(2),grid(3)])! place a pointer for a complex representation on tensorField + call c_f_pointer(phaseFieldFFT,phaseField_fourier,[grid1Red,grid(2),grid(3)]) ! place a pointer for a complex representation on tensorField !-------------------------------------------------------------------------------------------------- ! general initialization of FFTW (see manual on fftw.org for more details) @@ -308,7 +308,7 @@ subroutine utilities_init() endif if (debugFFTW) then - scalarField_realC = fftw_alloc_complex(int(product(grid),C_SIZE_T)) ! allocate data for real representation (no in place transform) + scalarField_realC = fftw_alloc_complex(int(product(grid),C_SIZE_T)) ! allllocate data for real representation (no in place transform) scalarField_fourierC = fftw_alloc_complex(int(product(grid),C_SIZE_T)) ! allocate data for fourier representation (no in place transform) call c_f_pointer(scalarField_realC, scalarField_real, grid) ! place a pointer for a real representation call c_f_pointer(scalarField_fourierC, scalarField_fourier, grid) ! place a pointer for a fourier representation diff --git a/code/homogenization.f90 b/code/homogenization.f90 index e86cf27bb..957570ff4 100644 --- a/code/homogenization.f90 +++ b/code/homogenization.f90 @@ -172,39 +172,24 @@ subroutine homogenization_init() allocate(homogenization_state0(mesh_maxNips,mesh_NcpElems)) allocate(homogenization_subState0(mesh_maxNips,mesh_NcpElems)) allocate(homogenization_state(mesh_maxNips,mesh_NcpElems)) - allocate(homogenization_sizeState(mesh_maxNips,mesh_NcpElems)) - homogenization_sizeState = 0_pInt - allocate(homogenization_sizePostResults(mesh_maxNips,mesh_NcpElems)) - homogenization_sizePostResults = 0_pInt - allocate(materialpoint_heat(mesh_maxNips,mesh_NcpElems)) - materialpoint_heat = 0.0_pReal - allocate(materialpoint_dPdF(3,3,3,3,mesh_maxNips,mesh_NcpElems)) - materialpoint_dPdF = 0.0_pReal - allocate(materialpoint_F0(3,3,mesh_maxNips,mesh_NcpElems)) - allocate(materialpoint_F(3,3,mesh_maxNips,mesh_NcpElems)) - materialpoint_F = 0.0_pReal - allocate(materialpoint_subF0(3,3,mesh_maxNips,mesh_NcpElems)) - materialpoint_subF0 = 0.0_pReal - allocate(materialpoint_subF(3,3,mesh_maxNips,mesh_NcpElems)) - materialpoint_subF = 0.0_pReal - allocate(materialpoint_P(3,3,mesh_maxNips,mesh_NcpElems)) - materialpoint_P = 0.0_pReal - allocate(materialpoint_subFrac(mesh_maxNips,mesh_NcpElems)) - materialpoint_subFrac = 0.0_pReal - allocate(materialpoint_subStep(mesh_maxNips,mesh_NcpElems)) - materialpoint_subStep = 0.0_pReal - allocate(materialpoint_subdt(mesh_maxNips,mesh_NcpElems)) - materialpoint_subdt = 0.0_pReal - allocate(materialpoint_requested(mesh_maxNips,mesh_NcpElems)) - materialpoint_requested = .false. - allocate(materialpoint_converged(mesh_maxNips,mesh_NcpElems)) - materialpoint_converged = .true. - allocate(materialpoint_doneAndHappy(2,mesh_maxNips,mesh_NcpElems)) - materialpoint_doneAndHappy = .true. - + allocate(homogenization_sizeState(mesh_maxNips,mesh_NcpElems), source=0_pInt) + allocate(homogenization_sizePostResults(mesh_maxNips,mesh_NcpElems), source=0_pInt) + allocate(materialpoint_heat(mesh_maxNips,mesh_NcpElems), source=0.0_pReal) + allocate(materialpoint_dPdF(3,3,3,3,mesh_maxNips,mesh_NcpElems), source=0.0_pReal) + allocate(materialpoint_F0(3,3,mesh_maxNips,mesh_NcpElems), source=0.0_pReal) materialpoint_F0 = spread(spread(math_I3,3,mesh_maxNips),4,mesh_NcpElems) ! initialize to identity - materialpoint_F = materialpoint_F0 - + allocate(materialpoint_F(3,3,mesh_maxNips,mesh_NcpElems), source=0.0_pReal) + materialpoint_F = materialpoint_F0 ! initialize to identity + allocate(materialpoint_subF0(3,3,mesh_maxNips,mesh_NcpElems), source=0.0_pReal) + allocate(materialpoint_subF(3,3,mesh_maxNips,mesh_NcpElems), source=0.0_pReal) + allocate(materialpoint_P(3,3,mesh_maxNips,mesh_NcpElems), source=0.0_pReal) + allocate(materialpoint_subFrac(mesh_maxNips,mesh_NcpElems), source=0.0_pReal) + allocate(materialpoint_subStep(mesh_maxNips,mesh_NcpElems), source=0.0_pReal) + allocate(materialpoint_subdt(mesh_maxNips,mesh_NcpElems), source=0.0_pReal) + allocate(materialpoint_requested(mesh_maxNips,mesh_NcpElems), source=.false.) + allocate(materialpoint_converged(mesh_maxNips,mesh_NcpElems), source=.true.) + allocate(materialpoint_doneAndHappy(2,mesh_maxNips,mesh_NcpElems), source=.true.) + !-------------------------------------------------------------------------------------------------- ! allocate and initialize global state and postresutls variables elementLooping: do e = 1,mesh_NcpElems