no need to use two loops
This commit is contained in:
parent
732022d4f0
commit
c0ac05aa88
|
@ -133,6 +133,7 @@ program DAMASK_spectral
|
||||||
incInfo, & !< string parsed to solution with information about current load case
|
incInfo, & !< string parsed to solution with information about current load case
|
||||||
workingDir
|
workingDir
|
||||||
type(tLoadCase), allocatable, dimension(:) :: loadCases !< array of all load cases
|
type(tLoadCase), allocatable, dimension(:) :: loadCases !< array of all load cases
|
||||||
|
type(tLoadCase) :: newLoadCase
|
||||||
type(tSolutionState), allocatable, dimension(:) :: solres
|
type(tSolutionState), allocatable, dimension(:) :: solres
|
||||||
integer(MPI_OFFSET_KIND) :: fileOffset
|
integer(MPI_OFFSET_KIND) :: fileOffset
|
||||||
integer(MPI_OFFSET_KIND), dimension(:), allocatable :: outputSize
|
integer(MPI_OFFSET_KIND), dimension(:), allocatable :: outputSize
|
||||||
|
@ -188,6 +189,7 @@ program DAMASK_spectral
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
! reading basic information from load case file and allocate data structure containing load cases
|
! reading basic information from load case file and allocate data structure containing load cases
|
||||||
|
allocate (loadCases(0)) ! array of load cases
|
||||||
open(newunit=fileunit,iostat=myStat,file=trim(loadCaseFile),action='read')
|
open(newunit=fileunit,iostat=myStat,file=trim(loadCaseFile),action='read')
|
||||||
if (myStat /= 0_pInt) call IO_error(100_pInt,el=myStat,ext_msg=trim(loadCaseFile))
|
if (myStat /= 0_pInt) call IO_error(100_pInt,el=myStat,ext_msg=trim(loadCaseFile))
|
||||||
do
|
do
|
||||||
|
@ -205,29 +207,27 @@ program DAMASK_spectral
|
||||||
N_n = N_n + 1_pInt
|
N_n = N_n + 1_pInt
|
||||||
end select
|
end select
|
||||||
enddo ! count all identifiers to allocate memory and do sanity check
|
enddo ! count all identifiers to allocate memory and do sanity check
|
||||||
enddo
|
if ((N_def /= N_n) .or. (N_n /= N_t) .or. N_n < 1_pInt) & ! sanity check
|
||||||
|
call IO_error(error_ID=837_pInt,ext_msg = trim(loadCaseFile)) ! error message for incomplete loadcase
|
||||||
if ((N_def /= N_n) .or. (N_n /= N_t) .or. N_n < 1_pInt) & ! sanity check
|
loadCases = [loadCases,newLoadCase]
|
||||||
call IO_error(error_ID=837_pInt,ext_msg = trim(loadCaseFile)) ! error message for incomplete loadcase
|
currentLoadCase = currentLoadCase + 1_pInt
|
||||||
allocate (loadCases(N_n)) ! array of load cases
|
loadCases(currentLoadCase)%stress%myType='stress'
|
||||||
loadCases%stress%myType='stress'
|
allocate(loadCases(currentLoadCase)%ID(nActiveFields))
|
||||||
|
|
||||||
do i = 1, size(loadCases)
|
|
||||||
allocate(loadCases(i)%ID(nActiveFields))
|
|
||||||
field = 1
|
field = 1
|
||||||
loadCases(i)%ID(field) = FIELD_MECH_ID ! mechanical active by default
|
loadCases(currentLoadCase)%ID(field) = FIELD_MECH_ID ! mechanical active by default
|
||||||
thermalActive: if (any(thermal_type == THERMAL_conduction_ID)) then
|
thermalActive: if (any(thermal_type == THERMAL_conduction_ID)) then
|
||||||
field = field + 1
|
field = field + 1
|
||||||
loadCases(i)%ID(field) = FIELD_THERMAL_ID
|
loadCases(currentLoadCase)%ID(field) = FIELD_THERMAL_ID
|
||||||
endif thermalActive
|
endif thermalActive
|
||||||
damageActive: if (any(damage_type == DAMAGE_nonlocal_ID)) then
|
damageActive: if (any(damage_type == DAMAGE_nonlocal_ID)) then
|
||||||
field = field + 1
|
field = field + 1
|
||||||
loadCases(i)%ID(field) = FIELD_DAMAGE_ID
|
loadCases(currentLoadCase)%ID(field) = FIELD_DAMAGE_ID
|
||||||
endif damageActive
|
endif damageActive
|
||||||
enddo
|
enddo
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
! reading the load case and assign values to the allocated data structure
|
! reading the load case and assign values to the allocated data structure
|
||||||
|
currentLoadCase = 0_pInt
|
||||||
rewind(FILEUNIT)
|
rewind(FILEUNIT)
|
||||||
do
|
do
|
||||||
read(fileUnit, '(A)', iostat=myStat) line
|
read(fileUnit, '(A)', iostat=myStat) line
|
||||||
|
@ -380,7 +380,7 @@ program DAMASK_spectral
|
||||||
case(FIELD_MECH_ID)
|
case(FIELD_MECH_ID)
|
||||||
call mech_init
|
call mech_init
|
||||||
|
|
||||||
case(FIELD_THERMAL_ID)
|
case(FIELD_THERMAL_ID)
|
||||||
call spectral_thermal_init
|
call spectral_thermal_init
|
||||||
|
|
||||||
case(FIELD_DAMAGE_ID)
|
case(FIELD_DAMAGE_ID)
|
||||||
|
|
Loading…
Reference in New Issue