From ed47d25adcd99c490515ca629278e3004099b6e7 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Wed, 9 Oct 2013 06:12:16 +0000 Subject: [PATCH] remove dotTemperature (returned always 0 anyway) to make it easier to replace it with a heating rate funtction remove potentially dangerous short circuiting in homogenization files added doxygen comment for nonlocal (giving the functions a name) fixed wrong definition of maxnchungs introcuded into dislotwin with last commit, causes trouble with hex --- code/constitutive.f90 | 69 +------------- code/constitutive_dislotwin.f90 | 90 +++++++------------ code/constitutive_j2.f90 | 35 +------- code/constitutive_none.f90 | 35 +------- code/constitutive_nonlocal.f90 | 135 ++++++++++------------------ code/constitutive_phenopowerlaw.f90 | 37 +------- code/constitutive_titanmod.f90 | 41 ++------- code/homogenization_RGC.f90 | 64 ++++++------- code/homogenization_isostrain.f90 | 34 +++---- code/lattice.f90 | 12 +-- 10 files changed, 148 insertions(+), 404 deletions(-) diff --git a/code/constitutive.f90 b/code/constitutive.f90 index 7d629015d..52efffb3b 100644 --- a/code/constitutive.f90 +++ b/code/constitutive.f90 @@ -919,34 +919,6 @@ end subroutine constitutive_collectDeltaState !> @brief contains the constitutive equation for calculating the rate of change of microstructure !-------------------------------------------------------------------------------------------------- real(pReal) function constitutive_dotTemperature(Tstar_v,Temperature,ipc,ip,el) - use prec, only: & - pLongInt - use debug, only: & - debug_cumDotTemperatureCalls, & - debug_cumDotTemperatureTicks, & - debug_level, & - debug_constitutive, & - debug_levelBasic - use material, only: & - phase_plasticity, & - material_phase - use constitutive_none, only: & - constitutive_none_dotTemperature, & - constitutive_none_label - use constitutive_j2, only: & - constitutive_j2_dotTemperature, & - constitutive_j2_label - use constitutive_phenopowerlaw, only: & - constitutive_phenopowerlaw_dotTemperature, & - constitutive_phenopowerlaw_label - use constitutive_titanmod, only: & - constitutive_titanmod_dotTemperature, & - constitutive_titanmod_label - use constitutive_dislotwin, only: constitutive_dislotwin_dotTemperature, & - constitutive_dislotwin_label - use constitutive_nonlocal, only: constitutive_nonlocal_dotTemperature, & - constitutive_nonlocal_label - implicit none integer(pInt), intent(in) :: & ipc, & !< grain number @@ -956,46 +928,7 @@ real(pReal) function constitutive_dotTemperature(Tstar_v,Temperature,ipc,ip,el) Temperature real(pReal), intent(in), dimension(6) :: & Tstar_v !< 2nd Piola-Kirchhoff stress - integer(pLongInt) :: & - tick, tock, & - tickrate, & - maxticks - - if (iand(debug_level(debug_constitutive),debug_levelBasic) /= 0_pInt) & - call system_clock(count=tick,count_rate=tickrate,count_max=maxticks) - - select case (phase_plasticity(material_phase(ipc,ip,el))) - - case (constitutive_none_label) - constitutive_dotTemperature = constitutive_none_dotTemperature(Tstar_v,Temperature,constitutive_state,ipc,ip,el) - - case (constitutive_j2_label) - constitutive_dotTemperature = constitutive_j2_dotTemperature(Tstar_v,Temperature,constitutive_state,ipc,ip,el) - - case (constitutive_phenopowerlaw_label) - constitutive_dotTemperature = constitutive_phenopowerlaw_dotTemperature(Tstar_v,Temperature,constitutive_state,ipc,ip,el) - - case (constitutive_titanmod_label) - constitutive_dotTemperature = constitutive_titanmod_dotTemperature(Tstar_v,Temperature,constitutive_state,ipc,ip,el) - - case (constitutive_dislotwin_label) - constitutive_dotTemperature = constitutive_dislotwin_dotTemperature(Tstar_v,Temperature,constitutive_state,ipc,ip,el) - - case (constitutive_nonlocal_label) - constitutive_dotTemperature = constitutive_nonlocal_dotTemperature(Tstar_v,Temperature,constitutive_state,ipc,ip,el) - - end select - - if (iand(debug_level(debug_constitutive),debug_levelBasic) /= 0_pInt) then - call system_clock(count=tock,count_rate=tickrate,count_max=maxticks) - !$OMP CRITICAL (debugTimingDotTemperature) - debug_cumDotTemperatureCalls = debug_cumDotTemperatureCalls + 1_pInt - debug_cumDotTemperatureTicks = debug_cumDotTemperatureTicks + tock-tick - !$OMP FLUSH (debug_cumDotTemperatureTicks) - if (tock < tick) debug_cumDotTemperatureTicks = debug_cumDotTemperatureTicks + maxticks - !$OMP END CRITICAL (debugTimingDotTemperature) - endif - + constitutive_dotTemperature = 0.0_pReal end function constitutive_dotTemperature diff --git a/code/constitutive_dislotwin.f90 b/code/constitutive_dislotwin.f90 index 54c84632e..d8e33c56f 100644 --- a/code/constitutive_dislotwin.f90 +++ b/code/constitutive_dislotwin.f90 @@ -159,7 +159,6 @@ use prec, only: & constitutive_dislotwin_LpAndItsTangent, & constitutive_dislotwin_dotState, & constitutive_dislotwin_deltaState, & - constitutive_dislotwin_dotTemperature, & constitutive_dislotwin_postResults contains @@ -189,8 +188,8 @@ subroutine constitutive_dislotwin_init(file) implicit none integer(pInt), intent(in) :: file - integer(pInt), parameter :: maxNchunks = 21_pInt - integer(pInt), dimension(1+2*maxNchunks) :: positions + integer(pInt), parameter :: MAXNCHUNKS = LATTICE_maxNinteraction + 1_pInt + integer(pInt), dimension(1+2*MAXNCHUNKS) :: positions integer(pInt), dimension(7) :: configNchunks integer(pInt) :: section = 0_pInt, maxNinstance,mySize=0_pInt,structID,maxTotalNslip,maxTotalNtwin,& f,i,j,k,l,m,n,o,p,q,r,s,ns,nt, & @@ -200,12 +199,12 @@ subroutine constitutive_dislotwin_init(file) character(len=65536) :: tag character(len=65536) :: line = '' ! to start initialized - write(6,'(/,a)') ' <<<+- constitutive_'//trim(constitutive_dislotwin_LABEL)//' init -+>>>' + write(6,'(/,a)') ' <<<+- constitutive_'//CONSTITUTIVE_DISLOTWIN_label//' init -+>>>' write(6,'(a)') ' $Id$' write(6,'(a15,a)') ' Current time: ',IO_timeStamp() #include "compilation_info.f90" - maxNinstance = int(count(phase_plasticity == constitutive_dislotwin_label),pInt) + maxNinstance = int(count(phase_plasticity == CONSTITUTIVE_DISLOTWIN_label),pInt) if (maxNinstance == 0_pInt) return if (iand(debug_level(debug_constitutive),debug_levelBasic) /= 0_pInt) & @@ -343,9 +342,9 @@ subroutine constitutive_dislotwin_init(file) cycle endif if (section > 0_pInt ) then ! do not short-circuit here (.and. with next if statemen). It's not safe in Fortran - if (phase_plasticity(section) == constitutive_dislotwin_LABEL) then ! one of my sections + if (trim(phase_plasticity(section)) == CONSTITUTIVE_DISLOTWIN_label) then ! one of my sections i = phase_plasticityInstance(section) ! which instance of my plasticity is present phase - positions = IO_stringPos(line,maxNchunks) + positions = IO_stringPos(line,MAXNCHUNKS) tag = IO_lc(IO_stringValue(line,positions,1_pInt)) ! extract key select case(tag) case ('plasticity', 'elasticity') @@ -384,7 +383,7 @@ subroutine constitutive_dislotwin_init(file) constitutive_dislotwin_Cslip_66(6,6,i) = IO_floatValue(line,positions,2_pInt) case ('nslip') if (positions(1) < 1_pInt + Nchunks_SlipFamilies) then - call IO_warning(50_pInt,ext_msg=trim(tag)//' ('//CONSTITUTIVE_DISLOTWIN_LABEL//')') + call IO_warning(50_pInt,ext_msg=trim(tag)//' ('//CONSTITUTIVE_DISLOTWIN_label//')') endif Nchunks_SlipFamilies = positions(1) - 1_pInt do j = 1_pInt, Nchunks_SlipFamilies @@ -392,7 +391,7 @@ subroutine constitutive_dislotwin_init(file) enddo case ('ntwin') if (positions(1) < 1_pInt + Nchunks_TwinFamilies) then - call IO_warning(51_pInt,ext_msg=trim(tag)//' ('//CONSTITUTIVE_DISLOTWIN_LABEL//')') + call IO_warning(51_pInt,ext_msg=trim(tag)//' ('//CONSTITUTIVE_DISLOTWIN_label//')') endif Nchunks_TwinFamilies = positions(1) - 1_pInt do j = 1_pInt, Nchunks_TwinFamilies @@ -470,28 +469,28 @@ subroutine constitutive_dislotwin_init(file) constitutive_dislotwin_CAtomicVolume(i) = IO_floatValue(line,positions,2_pInt) case ('interaction_slipslip','interactionslipslip') if (positions(1) < 1_pInt + Nchunks_SlipSlip) then - call IO_error(213_pInt,ext_msg=trim(tag)//' ('//CONSTITUTIVE_DISLOTWIN_LABEL//')') + call IO_error(213_pInt,ext_msg=trim(tag)//' ('//CONSTITUTIVE_DISLOTWIN_label//')') endif do j = 1_pInt, Nchunks_SlipSlip constitutive_dislotwin_interaction_SlipSlip(j,i) = IO_floatValue(line,positions,1_pInt+j) enddo case ('interaction_sliptwin','interactionsliptwin') if (positions(1) < 1_pInt + Nchunks_SlipTwin) then - call IO_error(213_pInt,ext_msg=trim(tag)//' ('//CONSTITUTIVE_DISLOTWIN_LABEL//')') + call IO_error(213_pInt,ext_msg=trim(tag)//' ('//CONSTITUTIVE_DISLOTWIN_label//')') endif do j = 1_pInt, Nchunks_SlipTwin constitutive_dislotwin_interaction_SlipTwin(j,i) = IO_floatValue(line,positions,1_pInt+j) enddo case ('interaction_twinslip','interactiontwinslip') if (positions(1) < 1_pInt + Nchunks_TwinSlip) then - call IO_error(213_pInt,ext_msg=trim(tag)//' ('//CONSTITUTIVE_DISLOTWIN_LABEL//')') + call IO_error(213_pInt,ext_msg=trim(tag)//' ('//CONSTITUTIVE_DISLOTWIN_label//')') endif do j = 1_pInt, Nchunks_TwinSlip constitutive_dislotwin_interaction_TwinSlip(j,i) = IO_floatValue(line,positions,1_pInt+j) enddo case ('interaction_twintwin','interactiontwintwin') if (positions(1) < 1_pInt + Nchunks_TwinTwin) then - call IO_error(213_pInt,ext_msg=trim(tag)//' ('//CONSTITUTIVE_DISLOTWIN_LABEL//')') + call IO_error(213_pInt,ext_msg=trim(tag)//' ('//CONSTITUTIVE_DISLOTWIN_label//')') endif do j = 1_pInt, Nchunks_TwinTwin constitutive_dislotwin_interaction_TwinTwin(j,i) = IO_floatValue(line,positions,1_pInt+j) @@ -507,7 +506,7 @@ subroutine constitutive_dislotwin_init(file) case ('qedgepersbsystem') constitutive_dislotwin_sbQedge(i) = IO_floatValue(line,positions,2_pInt) case default - call IO_error(210_pInt,ext_msg=trim(tag)//' ('//constitutive_dislotwin_label//')') + call IO_error(210_pInt,ext_msg=trim(tag)//' ('//CONSTITUTIVE_DISLOTWIN_label//')') end select endif endif @@ -520,46 +519,46 @@ subroutine constitutive_dislotwin_init(file) if (structID < 1_pInt) call IO_error(205_pInt,el=i) if (sum(constitutive_dislotwin_Nslip(:,i)) < 0_pInt) call IO_error(211_pInt,el=i,ext_msg='Nslip (' & - //constitutive_dislotwin_label//')') + //CONSTITUTIVE_DISLOTWIN_label//')') if (sum(constitutive_dislotwin_Ntwin(:,i)) < 0_pInt) call IO_error(211_pInt,el=i,ext_msg='Ntwin (' & - //constitutive_dislotwin_label//')') + //CONSTITUTIVE_DISLOTWIN_label//')') do f = 1_pInt,lattice_maxNslipFamily if (constitutive_dislotwin_Nslip(f,i) > 0_pInt) then if (constitutive_dislotwin_rhoEdge0(f,i) < 0.0_pReal) call IO_error(211_pInt,el=i,ext_msg='rhoEdge0 (' & - //constitutive_dislotwin_label//')') + //CONSTITUTIVE_DISLOTWIN_label//')') if (constitutive_dislotwin_rhoEdgeDip0(f,i) < 0.0_pReal) call IO_error(211_pInt,el=i,ext_msg='rhoEdgeDip0 (' & - //constitutive_dislotwin_label//')') + //CONSTITUTIVE_DISLOTWIN_label//')') if (constitutive_dislotwin_burgersPerSlipFamily(f,i) <= 0.0_pReal) call IO_error(211_pInt,el=i,ext_msg='slipBurgers (' & - //constitutive_dislotwin_label//')') + //CONSTITUTIVE_DISLOTWIN_label//')') if (constitutive_dislotwin_v0PerSlipFamily(f,i) <= 0.0_pReal) call IO_error(211_pInt,el=i,ext_msg='v0 (' & - //constitutive_dislotwin_label//')') + //CONSTITUTIVE_DISLOTWIN_label//')') endif enddo do f = 1_pInt,lattice_maxNtwinFamily if (constitutive_dislotwin_Ntwin(f,i) > 0_pInt) then if (constitutive_dislotwin_burgersPerTwinFamily(f,i) <= 0.0_pReal) call IO_error(211_pInt,el=i,ext_msg='twinburgers (' & - //constitutive_dislotwin_label//')') + //CONSTITUTIVE_DISLOTWIN_label//')') if (constitutive_dislotwin_Ndot0PerTwinFamily(f,i) < 0.0_pReal) call IO_error(211_pInt,el=i,ext_msg='ndot0 (' & - //constitutive_dislotwin_label//')') + //CONSTITUTIVE_DISLOTWIN_label//')') endif enddo if (constitutive_dislotwin_CAtomicVolume(i) <= 0.0_pReal) call IO_error(211_pInt,el=i,ext_msg='cAtomicVolume (' & - //constitutive_dislotwin_label//')') + //CONSTITUTIVE_DISLOTWIN_label//')') if (constitutive_dislotwin_D0(i) <= 0.0_pReal) call IO_error(211_pInt,el=i,ext_msg='D0 (' & - //constitutive_dislotwin_label//')') + //CONSTITUTIVE_DISLOTWIN_label//')') if (constitutive_dislotwin_Qsd(i) <= 0.0_pReal) call IO_error(211_pInt,el=i,ext_msg='Qsd (' & - //constitutive_dislotwin_label//')') + //CONSTITUTIVE_DISLOTWIN_label//')') if (constitutive_dislotwin_SFE_0K(i) == 0.0_pReal .and. & constitutive_dislotwin_dSFE_dT(i) == 0.0_pReal) call IO_error(211_pInt,el=i,ext_msg='SFE (' & - //constitutive_dislotwin_label//')') + //CONSTITUTIVE_DISLOTWIN_label//')') if (constitutive_dislotwin_aTolRho(i) <= 0.0_pReal) call IO_error(211_pInt,el=i,ext_msg='aTolRho (' & - //constitutive_dislotwin_label//')') + //CONSTITUTIVE_DISLOTWIN_label//')') if (constitutive_dislotwin_aTolTwinFrac(i) <= 0.0_pReal) call IO_error(211_pInt,el=i,ext_msg='aTolTwinFrac (' & - //constitutive_dislotwin_label//')') + //CONSTITUTIVE_DISLOTWIN_label//')') if (constitutive_dislotwin_sbResistance(i) < 0.0_pReal) call IO_error(211_pInt,el=i,ext_msg='sbResistance (' & - //constitutive_dislotwin_label//')') + //CONSTITUTIVE_DISLOTWIN_label//')') if (constitutive_dislotwin_sbVelocity(i) < 0.0_pReal) call IO_error(211_pInt,el=i,ext_msg='sbVelocity (' & - //constitutive_dislotwin_label//')') + //CONSTITUTIVE_DISLOTWIN_label//')') !* Determine total number of active slip or twin systems constitutive_dislotwin_Nslip(:,i) = min(lattice_NslipSystem(:,structID),constitutive_dislotwin_Nslip(:,i)) @@ -654,7 +653,7 @@ subroutine constitutive_dislotwin_init(file) case('sb_eigenvectors') mySize = 9_pInt case default - call IO_error(212_pInt,ext_msg=constitutive_dislotwin_output(o,i)//' ('//constitutive_dislotwin_label//')') + call IO_error(212_pInt,ext_msg=constitutive_dislotwin_output(o,i)//' ('//CONSTITUTIVE_DISLOTWIN_label//')') end select if (mySize > 0_pInt) then ! any meaningful output found @@ -1568,35 +1567,6 @@ pure function constitutive_dislotwin_deltaState(Tstar_v,temperature,state,ipc,ip end function constitutive_dislotwin_deltaState - -!-------------------------------------------------------------------------------------------------- -!> @brief calculates the rate of change of temperature -!> @details dummy function, returns 0.0 -!-------------------------------------------------------------------------------------------------- -real(pReal) pure function constitutive_dislotwin_dotTemperature(Tstar_v,temperature,state,ipc,ip,el) - use prec, only: & - p_vec - use mesh, only: & - mesh_NcpElems, & - mesh_maxNips - use material, only: & - homogenization_maxNgrains - - implicit none - real(pReal), dimension(6), intent(in) :: & - Tstar_v !< 2nd Piola Kirchhoff stress tensor in Mandel notation - real(pReal), intent(in) :: & - temperature !< temperature at integration point - integer(pInt), intent(in) :: & - ipc, & !< component-ID of integration point - ip, & !< integration point - el !< element - type(p_vec), dimension(homogenization_maxNgrains,mesh_maxNips,mesh_NcpElems), intent(in) :: & - state !< microstructure state - - constitutive_dislotwin_dotTemperature = 0.0_pReal - -end function constitutive_dislotwin_dotTemperature !-------------------------------------------------------------------------------------------------- !> @brief return array of constitutive results diff --git a/code/constitutive_j2.f90 b/code/constitutive_j2.f90 index 0a733bb4c..ddce46424 100644 --- a/code/constitutive_j2.f90 +++ b/code/constitutive_j2.f90 @@ -84,7 +84,6 @@ module constitutive_j2 constitutive_j2_LpAndItsTangent, & constitutive_j2_dotState, & constitutive_j2_deltaState, & - constitutive_j2_dotTemperature, & constitutive_j2_postResults contains @@ -128,7 +127,7 @@ subroutine constitutive_j2_init(myFile) tag = '', & line = '' ! to start initialized - write(6,'(/,a)') ' <<<+- constitutive_'//trim(CONSTITUTIVE_J2_label)//' init -+>>>' + write(6,'(/,a)') ' <<<+- constitutive_'//CONSTITUTIVE_J2_label//' init -+>>>' write(6,'(a)') ' $Id$' write(6,'(a15,a)') ' Current time: ',IO_timeStamp() #include "compilation_info.f90" @@ -196,7 +195,7 @@ subroutine constitutive_j2_init(myFile) cycle ! skip to next line endif if (section > 0_pInt ) then ! do not short-circuit here (.and. with next if-statement). It's not safe in Fortran - if (phase_plasticity(section) == CONSTITUTIVE_J2_label) then ! one of my sections + if (trim(phase_plasticity(section)) == CONSTITUTIVE_J2_label) then ! one of my sections i = phase_plasticityInstance(section) ! which instance of my plasticity is present phase positions = IO_stringPos(line,MAXNCHUNKS) tag = IO_lc(IO_stringValue(line,positions,1_pInt)) ! extract key @@ -594,36 +593,6 @@ pure function constitutive_j2_deltaState(Tstar_v,temperature,state,ipc,ip,el) end function constitutive_j2_deltaState -!-------------------------------------------------------------------------------------------------- -!> @brief calculates the rate of change of temperature -!> @details dummy function, returns 0.0 -!-------------------------------------------------------------------------------------------------- -real(pReal) pure function constitutive_j2_dotTemperature(Tstar_v,temperature,state,ipc,ip,el) - use prec, only: & - p_vec - use mesh, only: & - mesh_NcpElems, & - mesh_maxNips - use material, only: & - homogenization_maxNgrains - - implicit none - real(pReal), dimension(6), intent(in) :: & - Tstar_v !< 2nd Piola Kirchhoff stress tensor in Mandel notation - real(pReal), intent(in) :: & - temperature !< temperature at integration point - integer(pInt), intent(in) :: & - ipc, & !< component-ID of integration point - ip, & !< integration point - el !< element - type(p_vec), dimension(homogenization_maxNgrains,mesh_maxNips,mesh_NcpElems), intent(in) :: & - state !< microstructure state - - constitutive_j2_dotTemperature = 0.0_pReal - -end function constitutive_j2_dotTemperature - - !-------------------------------------------------------------------------------------------------- !> @brief return array of constitutive results !-------------------------------------------------------------------------------------------------- diff --git a/code/constitutive_none.f90 b/code/constitutive_none.f90 index 6afd05325..e7e524776 100644 --- a/code/constitutive_none.f90 +++ b/code/constitutive_none.f90 @@ -56,7 +56,6 @@ module constitutive_none constitutive_none_LpAndItsTangent, & constitutive_none_dotState, & constitutive_none_deltaState, & - constitutive_none_dotTemperature, & constitutive_none_postResults contains @@ -100,7 +99,7 @@ subroutine constitutive_none_init(myFile) tag = '', & line = '' ! to start initialized - write(6,'(/,a)') ' <<<+- constitutive_'//trim(CONSTITUTIVE_NONE_label)//' init -+>>>' + write(6,'(/,a)') ' <<<+- constitutive_'//CONSTITUTIVE_NONE_label//' init -+>>>' write(6,'(a)') ' $Id$' write(6,'(a15,a)') ' Current time: ',IO_timeStamp() #include "compilation_info.f90" @@ -137,7 +136,7 @@ subroutine constitutive_none_init(myFile) cycle endif if (section > 0_pInt ) then ! do not short-circuit here (.and. with next if-statement). It's not safe in Fortran - if (phase_plasticity(section) == CONSTITUTIVE_NONE_label) then ! one of my sections + if (trim(phase_plasticity(section)) == CONSTITUTIVE_NONE_label) then ! one of my sections i = phase_plasticityInstance(section) ! which instance of my plasticity is present phase positions = IO_stringPos(line,MAXNCHUNKS) tag = IO_lc(IO_stringValue(line,positions,1_pInt)) ! extract key @@ -388,36 +387,6 @@ function constitutive_none_deltaState(Tstar_v,temperature,state,ipc,ip,el) end function constitutive_none_deltaState -!-------------------------------------------------------------------------------------------------- -!> @brief calculates the rate of change of temperature -!> @details dummy function, returns 0.0 -!-------------------------------------------------------------------------------------------------- -real(pReal) pure function constitutive_none_dotTemperature(Tstar_v,temperature,state,ipc,ip,el) - use prec, only: & - p_vec - use mesh, only: & - mesh_NcpElems, & - mesh_maxNips - use material, only: & - homogenization_maxNgrains - - implicit none - real(pReal), dimension(6), intent(in) :: & - Tstar_v !< 2nd Piola Kirchhoff stress tensor in Mandel notation - real(pReal), intent(in) :: & - temperature !< temperature at integration point - integer(pInt), intent(in) :: & - ipc, & !< component-ID of integration point - ip, & !< integration point - el !< element - type(p_vec), dimension(homogenization_maxNgrains,mesh_maxNips,mesh_NcpElems), intent(in) :: & - state !< microstructure state - - constitutive_none_dotTemperature = 0.0_pReal - -end function constitutive_none_dotTemperature - - !-------------------------------------------------------------------------------------------------- !> @brief return array of constitutive results !> @details dummy function, returns 0.0 diff --git a/code/constitutive_nonlocal.f90 b/code/constitutive_nonlocal.f90 index 86bc1e976..0f1f119f3 100644 --- a/code/constitutive_nonlocal.f90 +++ b/code/constitutive_nonlocal.f90 @@ -205,7 +205,6 @@ constitutive_nonlocal_microstructure, & constitutive_nonlocal_LpAndItsTangent, & constitutive_nonlocal_dotState, & constitutive_nonlocal_deltaState, & -constitutive_nonlocal_dotTemperature, & constitutive_nonlocal_updateCompatibility, & constitutive_nonlocal_postResults @@ -216,9 +215,10 @@ constitutive_nonlocal_dislocationstress CONTAINS -!************************************** -!* Module initialization * -!************************************** +!-------------------------------------------------------------------------------------------------- +!> @brief module initialization +!> @details reads in material parameters, allocates arrays, and does sanity checks +!-------------------------------------------------------------------------------------------------- subroutine constitutive_nonlocal_init(myFile) use, intrinsic :: iso_fortran_env ! to get compiler_version and compiler_options (at least for gfortran 4.6 at the moment) @@ -255,7 +255,7 @@ use lattice integer(pInt), intent(in) :: myFile !*** local variables - integer(pInt), parameter :: MAXNCHUNKS = lattice_maxNinteraction + 1_pInt + integer(pInt), parameter :: MAXNCHUNKS = LATTICE_maxNinteraction + 1_pInt integer(pInt), & dimension(1_pInt+2_pInt*MAXNCHUNKS) :: positions integer(pInt), dimension(7) :: configNchunks @@ -281,19 +281,16 @@ integer(pInt) :: section = 0_pInt, & character(len=65536) tag character(len=65536) :: line = '' ! to start initialized - write(6,*) - write(6,*) '<<<+- constitutive_',trim(CONSTITUTIVE_NONLOCAL_LABEL),' init -+>>>' - write(6,*) '$Id$' - write(6,'(a16,a)') ' Current time : ',IO_timeStamp() + write(6,'(/,a)') ' <<<+- constitutive_'//CONSTITUTIVE_NONLOCAL_label//' init -+>>>' + write(6,'(a)') ' $Id$' + write(6,'(a15,a)') ' Current time: ',IO_timeStamp() #include "compilation_info.f90" -maxNinstance = int(count(phase_plasticity == CONSTITUTIVE_NONLOCAL_LABEL),pInt) -if (maxNinstance == 0) return ! we don't have to do anything if there's no instance for this constitutive law + maxNinstance = int(count(phase_plasticity == CONSTITUTIVE_NONLOCAL_LABEL),pInt) + if (maxNinstance == 0) return ! we don't have to do anything if there's no instance for this constitutive law -if (iand(debug_level(debug_constitutive),debug_levelBasic) /= 0_pInt) then - write(6,'(a16,1x,i5)') '# instances:',maxNinstance - write(6,*) -endif + if (iand(debug_level(debug_constitutive),debug_levelBasic) /= 0_pInt) & + write(6,'(a16,1x,i5,/)') '# instances:',maxNinstance !*** memory allocation for global variables @@ -433,7 +430,7 @@ do while (trim(line) /= '#EOF#') cycle endif if (section > 0_pInt ) then ! do not short-circuit here (.and. with next if statemen). It's not safe in Fortran - if (phase_plasticity(section) == CONSTITUTIVE_NONLOCAL_LABEL) then ! one of my sections + if (trim(phase_plasticity(section)) == CONSTITUTIVE_NONLOCAL_LABEL) then ! one of my sections i = phase_plasticityInstance(section) ! which instance of my plasticity is present phase positions = IO_stringPos(line,MAXNCHUNKS) tag = IO_lc(IO_stringValue(line,positions,1_pInt)) ! extract key @@ -1038,13 +1035,13 @@ do i = 1,maxNinstance enddo -endsubroutine +end subroutine constitutive_nonlocal_init -!********************************************************************* -!* initial microstructural state (just the "basic" states) * -!********************************************************************* +!-------------------------------------------------------------------------------------------------- +!> @brief sets the initial microstructural state for a given instance of this plasticity +!-------------------------------------------------------------------------------------------------- subroutine constitutive_nonlocal_stateInit(state) use IO, only: IO_error @@ -1167,13 +1164,13 @@ do matID = 1_pInt,maxNinstance endif enddo -endsubroutine +end subroutine constitutive_nonlocal_stateInit -!********************************************************************* -!* absolute state tolerance * -!********************************************************************* +!-------------------------------------------------------------------------------------------------- +!> @brief sets the relevant state values for a given instance of this plasticity +!-------------------------------------------------------------------------------------------------- pure function constitutive_nonlocal_aTolState(matID) implicit none @@ -1198,13 +1195,13 @@ forall (c = 1_pInt:2_pInt) & constitutive_nonlocal_aTolState(iRhoD(1:ns,c,matID)) = aTolRho(matID) constitutive_nonlocal_aTolState(iGamma(1:ns,matID)) = aTolShear(matID) -endfunction +end function constitutive_nonlocal_aTolState -!********************************************************************* -!* calculates homogenized elacticity matrix * -!********************************************************************* +!-------------------------------------------------------------------------------------------------- +!> @brief returns the homogenized elasticity matrix +!-------------------------------------------------------------------------------------------------- pure function constitutive_nonlocal_homogenizedC(state,g,ip,el) use mesh, only: mesh_NcpElems, & @@ -1230,13 +1227,12 @@ matID = phase_plasticityInstance(material_phase(g,ip,el)) constitutive_nonlocal_homogenizedC = Cslip66(1:6,1:6,matID) -endfunction +end function constitutive_nonlocal_homogenizedC - -!********************************************************************* -!* calculates quantities characterizing the microstructure * -!********************************************************************* +!-------------------------------------------------------------------------------------------------- +!> @brief calculates quantities characterizing the microstructure +!-------------------------------------------------------------------------------------------------- subroutine constitutive_nonlocal_microstructure(state, Temperature, Fe, Fp, gr, ip, el) use IO, only: & @@ -1547,13 +1543,12 @@ state(gr,ip,el)%p(iTauB(1:ns,instance)) = tauBack endif #endif -endsubroutine +end subroutine constitutive_nonlocal_microstructure - -!********************************************************************* -!* calculates kinetics * -!********************************************************************* +!-------------------------------------------------------------------------------------------------- +!> @brief calculates kinetics +!-------------------------------------------------------------------------------------------------- subroutine constitutive_nonlocal_kinetics(v, dv_dtau, dv_dtauNS, tau, tauNS, & tauThreshold, c, Temperature, g, ip, el) @@ -1711,13 +1706,12 @@ endif endif #endif -endsubroutine +end subroutine constitutive_nonlocal_kinetics - -!********************************************************************* -!* calculates plastic velocity gradient and its tangent * -!********************************************************************* +!-------------------------------------------------------------------------------------------------- +!> @brief calculates plastic velocity gradient and its tangent +!-------------------------------------------------------------------------------------------------- subroutine constitutive_nonlocal_LpAndItsTangent(Lp, dLp_dTstar99, Tstar_v, Temperature, state, g, ip, el) use math, only: math_Plain3333to99, & @@ -1912,13 +1906,12 @@ dLp_dTstar99 = math_Plain3333to99(dLp_dTstar3333) endif #endif -endsubroutine +end subroutine constitutive_nonlocal_LpAndItsTangent - -!********************************************************************* -!* incremental change of microstructure * -!********************************************************************* +!-------------------------------------------------------------------------------------------------- +!> @brief (instantaneous) incremental change of microstructure +!-------------------------------------------------------------------------------------------------- subroutine constitutive_nonlocal_deltaState(deltaState, state, Tstar_v, Temperature, g,ip,el) use debug, only: debug_level, & @@ -2103,13 +2096,13 @@ forall (s = 1:ns, c = 1_pInt:2_pInt) & endif #endif -endsubroutine +end subroutine constitutive_nonlocal_deltaState -!********************************************************************* -!* rate of change of microstructure * -!********************************************************************* +!-------------------------------------------------------------------------------------------------- +!> @brief calculates the rate of change of microstructure +!-------------------------------------------------------------------------------------------------- function constitutive_nonlocal_dotState(Tstar_v, Fe, Fp, Temperature, state, state0, timestep, subfrac, g,ip,el) use prec, only: DAMASK_NaN @@ -2719,7 +2712,7 @@ else constitutive_nonlocal_dotState(iGamma(s,matID)) = sum(gdot(s,1:4)) endif -endfunction +end function constitutive_nonlocal_dotState @@ -2897,39 +2890,7 @@ enddo ! neighbor cycle compatibility(1:2,1:ns,1:ns,1:Nneighbors,i,e) = my_compatibility -endsubroutine - - - -!********************************************************************* -!* rate of change of temperature * -!********************************************************************* -pure function constitutive_nonlocal_dotTemperature(Tstar_v,Temperature,state,g,ip,el) - -use mesh, only: mesh_NcpElems, & - mesh_maxNips -use material, only: homogenization_maxNgrains -implicit none - -!* input variables -integer(pInt), intent(in) :: g, & ! current grain ID - ip, & ! current integration point - el ! current element -real(pReal), intent(in) :: Temperature ! temperature -real(pReal), dimension(6), intent(in) :: Tstar_v ! 2nd Piola-Kirchhoff stress in Mandel notation -type(p_vec), dimension(homogenization_maxNgrains,mesh_maxNips,mesh_NcpElems), intent(in) :: & - state ! microstructural state - -!* output variables -real(pReal) constitutive_nonlocal_dotTemperature ! evolution of Temperature - -!* local variables - -constitutive_nonlocal_dotTemperature = 0.0_pReal - -endfunction - - +end subroutine constitutive_nonlocal_updateCompatibility !********************************************************************* @@ -3280,7 +3241,7 @@ ipLoop: do neighbor_ip = 1_pInt,FE_Nips(FE_geomtype(mesh_element(2,neighbor_el)) endif -endfunction +end function constitutive_nonlocal_dislocationstress !********************************************************************* diff --git a/code/constitutive_phenopowerlaw.f90 b/code/constitutive_phenopowerlaw.f90 index 03a916ca7..58317d19e 100644 --- a/code/constitutive_phenopowerlaw.f90 +++ b/code/constitutive_phenopowerlaw.f90 @@ -106,7 +106,6 @@ module constitutive_phenopowerlaw constitutive_phenopowerlaw_LpAndItsTangent, & constitutive_phenopowerlaw_dotState, & constitutive_phenopowerlaw_deltaState, & - constitutive_phenopowerlaw_dotTemperature, & constitutive_phenopowerlaw_postResults contains @@ -134,7 +133,7 @@ subroutine constitutive_phenopowerlaw_init(myFile) implicit none integer(pInt), intent(in) :: myFile - integer(pInt), parameter :: MAXNCHUNKS = lattice_maxNinteraction + 1_pInt + integer(pInt), parameter :: MAXNCHUNKS = LATTICE_maxNinteraction + 1_pInt integer(pInt), dimension(1_pInt+2_pInt*MAXNCHUNKS) :: positions integer(pInt), dimension(7) :: configNchunks integer(pInt) :: & @@ -148,7 +147,7 @@ subroutine constitutive_phenopowerlaw_init(myFile) tag = '', & line = '' ! to start initialized - write(6,'(/,a)') ' <<<+- constitutive_'//trim(CONSTITUTIVE_PHENOPOWERLAW_label)//' init -+>>>' + write(6,'(/,a)') ' <<<+- constitutive_'//CONSTITUTIVE_PHENOPOWERLAW_label//' init -+>>>' write(6,'(a)') ' $Id$' write(6,'(a15,a)') ' Current time: ',IO_timeStamp() #include "compilation_info.f90" @@ -259,7 +258,7 @@ subroutine constitutive_phenopowerlaw_init(myFile) cycle ! skip to next line endif if (section > 0_pInt ) then ! do not short-circuit here (.and. with next if-statement). It's not safe in Fortran - if (phase_plasticity(section) == CONSTITUTIVE_PHENOPOWERLAW_label) then ! one of my sections + if (trim(phase_plasticity(section)) == CONSTITUTIVE_PHENOPOWERLAW_label) then ! one of my sections i = phase_plasticityInstance(section) ! which instance of my plasticity is present phase positions = IO_stringPos(line,MAXNCHUNKS) tag = IO_lc(IO_stringValue(line,positions,1_pInt)) ! extract key @@ -1066,36 +1065,6 @@ pure function constitutive_phenopowerlaw_deltaState(Tstar_v,temperature,state,ip end function constitutive_phenopowerlaw_deltaState -!-------------------------------------------------------------------------------------------------- -!> @brief calculates the rate of change of temperature -!> @details dummy function, returns 0.0 -!-------------------------------------------------------------------------------------------------- -real(pReal) pure function constitutive_phenopowerlaw_dotTemperature(Tstar_v,temperature,state,ipc,ip,el) - use prec, only: & - p_vec - use mesh, only: & - mesh_NcpElems, & - mesh_maxNips - use material, only: & - homogenization_maxNgrains - - implicit none - real(pReal), dimension(6), intent(in) :: & - Tstar_v !< 2nd Piola Kirchhoff stress tensor in Mandel notation - real(pReal), intent(in) :: & - temperature !< temperature at integration point - integer(pInt), intent(in) :: & - ipc, & !< component-ID of integration point - ip, & !< integration point - el !< element - type(p_vec), dimension(homogenization_maxNgrains,mesh_maxNips,mesh_NcpElems), intent(in) :: & - state - - constitutive_phenopowerlaw_dotTemperature = 0.0_pReal - -end function constitutive_phenopowerlaw_dotTemperature - - !-------------------------------------------------------------------------------------------------- !> @brief return array of constitutive results !-------------------------------------------------------------------------------------------------- diff --git a/code/constitutive_titanmod.f90 b/code/constitutive_titanmod.f90 index 9d650f2ac..5f5e9ab1e 100644 --- a/code/constitutive_titanmod.f90 +++ b/code/constitutive_titanmod.f90 @@ -190,7 +190,6 @@ module constitutive_titanmod constitutive_titanmod_LpAndItsTangent, & constitutive_titanmod_dotState, & constitutive_titanmod_deltaState, & - constitutive_titanmod_dotTemperature, & constitutive_titanmod_postResults, & constitutive_titanmod_homogenizedC, & constitutive_titanmod_aTolState @@ -220,7 +219,7 @@ subroutine constitutive_titanmod_init(myFile) implicit none integer(pInt), intent(in) :: myFile - integer(pInt), parameter :: MAXNCHUNKS = 21_pInt + integer(pInt), parameter :: MAXNCHUNKS = LATTICE_maxNinteraction + 1_pInt integer(pInt), dimension(1_pInt+2_pInt*MAXNCHUNKS) :: positions integer(pInt), dimension(7) :: configNchunks integer(pInt) :: & @@ -230,15 +229,15 @@ subroutine constitutive_titanmod_init(myFile) s, s1, s2, & t, t1, t2, & ns, nt, & - Nchunks_SlipSlip, Nchunks_SlipTwin, Nchunks_TwinSlip, Nchunks_TwinTwin, & - Nchunks_SlipFamilies, Nchunks_TwinFamilies, & + Nchunks_SlipSlip, Nchunks_SlipTwin, Nchunks_TwinSlip, Nchunks_TwinTwin, & + Nchunks_SlipFamilies, Nchunks_TwinFamilies, & mySize, structID, & maxTotalNslip,maxTotalNtwin, maxNinstance character(len=65536) :: & tag = '', & line = '' ! to start initialized - write(6,'(/,a)') ' <<<+- constitutive_'//trim(CONSTITUTIVE_TITANMOD_label)//' init -+>>>' + write(6,'(/,a)') ' <<<+- constitutive_'//CONSTITUTIVE_TITANMOD_label//' init -+>>>' write(6,'(a)') ' $Id$' write(6,'(a15,a)') ' Current time: ',IO_timeStamp() #include "compilation_info.f90" @@ -407,7 +406,7 @@ subroutine constitutive_titanmod_init(myFile) cycle ! skip to next line endif if (section > 0_pInt ) then ! do not short-circuit here (.and. with next if-statement). It's not safe in Fortran - if (phase_plasticity(section) == CONSTITUTIVE_TITANMOD_label) then ! one of my sections + if (trim(phase_plasticity(section)) == CONSTITUTIVE_TITANMOD_label) then ! one of my sections i = phase_plasticityInstance(section) ! which instance of my plasticity is present phase positions = IO_stringPos(line,MAXNCHUNKS) tag = IO_lc(IO_stringValue(line,positions,1_pInt)) ! extract key @@ -1739,36 +1738,6 @@ pure function constitutive_titanmod_deltaState(Tstar_v,temperature,state,ipc,ip, end function constitutive_titanmod_deltaState -!-------------------------------------------------------------------------------------------------- -!> @brief calculates the rate of change of temperature -!> @details dummy function, returns 0.0 -!-------------------------------------------------------------------------------------------------- -real(pReal) pure function constitutive_titanmod_dotTemperature(Tstar_v,temperature,state,ipc,ip,el) - use prec, only: & - p_vec - use mesh, only: & - mesh_NcpElems, & - mesh_maxNips - use material, only: & - homogenization_maxNgrains - - implicit none - real(pReal), dimension(6), intent(in) :: & - Tstar_v !< 2nd Piola Kirchhoff stress tensor in Mandel notation - real(pReal), intent(in) :: & - temperature !< temperature at integration point - integer(pInt), intent(in) :: & - ipc, & !< component-ID of integration point - ip, & !< integration point - el !< element - type(p_vec), dimension(homogenization_maxNgrains,mesh_maxNips,mesh_NcpElems), intent(in) :: & - state !< microstructure state - - constitutive_titanmod_dotTemperature = 0.0_pReal - -end function constitutive_titanmod_dotTemperature - - !-------------------------------------------------------------------------------------------------- !> @brief return array of constitutive results !-------------------------------------------------------------------------------------------------- diff --git a/code/homogenization_RGC.f90 b/code/homogenization_RGC.f90 index 5f2a988fe..e08429602 100644 --- a/code/homogenization_RGC.f90 +++ b/code/homogenization_RGC.f90 @@ -33,7 +33,7 @@ module homogenization_RGC implicit none private character (len=*), parameter, public :: & - homogenization_RGC_label = 'rgc' + HOMOGENIZATION_RGC_label = 'rgc' integer(pInt), dimension(:), allocatable, public :: & homogenization_RGC_sizeState, & homogenization_RGC_sizePostResults @@ -111,12 +111,12 @@ subroutine homogenization_RGC_init(myFile) character(len=65536) :: tag character(len=65536) :: line = '' - write(6,'(/,3a)') ' <<<+- homogenization_',trim(homogenization_RGC_label),' init -+>>>' - write(6,'(a)') ' $Id$' - write(6,'(a16,a)') ' Current time : ',IO_timeStamp() + write(6,'(/,a)') ' <<<+- homogenization_'//HOMOGENIZATION_RGC_label//' init -+>>>' + write(6,'(a)') ' $Id$' + write(6,'(a15,a)') ' Current time: ',IO_timeStamp() #include "compilation_info.f90" - maxNinstance = int(count(homogenization_type == homogenization_RGC_label),pInt) + maxNinstance = int(count(homogenization_type == HOMOGENIZATION_RGC_label),pInt) if (maxNinstance == 0_pInt) return allocate(homogenization_RGC_sizeState(maxNinstance)); homogenization_RGC_sizeState = 0_pInt @@ -147,38 +147,40 @@ subroutine homogenization_RGC_init(myFile) section = section + 1_pInt output = 0_pInt ! reset output counter endif - if (section > 0_pInt .and. homogenization_type(section) == homogenization_RGC_label) then ! one of my sections - i = homogenization_typeInstance(section) ! which instance of my type is present homogenization - positions = IO_stringPos(line,maxNchunks) - tag = IO_lc(IO_stringValue(line,positions,1_pInt)) ! extract key - select case(tag) - case ('(output)') - output = output + 1_pInt - homogenization_RGC_output(output,i) = IO_lc(IO_stringValue(line,positions,2_pInt)) - case ('clustersize') - homogenization_RGC_Ngrains(1,i) = IO_intValue(line,positions,2_pInt) - homogenization_RGC_Ngrains(2,i) = IO_intValue(line,positions,3_pInt) - homogenization_RGC_Ngrains(3,i) = IO_intValue(line,positions,4_pInt) - case ('scalingparameter') - homogenization_RGC_xiAlpha(i) = IO_floatValue(line,positions,2_pInt) - case ('overproportionality') - homogenization_RGC_ciAlpha(i) = IO_floatValue(line,positions,2_pInt) - case ('grainsize') - homogenization_RGC_dAlpha(1,i) = IO_floatValue(line,positions,2_pInt) - homogenization_RGC_dAlpha(2,i) = IO_floatValue(line,positions,3_pInt) - homogenization_RGC_dAlpha(3,i) = IO_floatValue(line,positions,4_pInt) - case ('clusterorientation') - homogenization_RGC_angles(1,i) = IO_floatValue(line,positions,2_pInt) - homogenization_RGC_angles(2,i) = IO_floatValue(line,positions,3_pInt) - homogenization_RGC_angles(3,i) = IO_floatValue(line,positions,4_pInt) - end select + if (section > 0_pInt ) then ! do not short-circuit here (.and. with next if-statement). It's not safe in Fortran + if (trim(homogenization_type(section)) == HOMOGENIZATION_RGC_label) then ! one of my sections + i = homogenization_typeInstance(section) ! which instance of my type is present homogenization + positions = IO_stringPos(line,maxNchunks) + tag = IO_lc(IO_stringValue(line,positions,1_pInt)) ! extract key + select case(tag) + case ('(output)') + output = output + 1_pInt + homogenization_RGC_output(output,i) = IO_lc(IO_stringValue(line,positions,2_pInt)) + case ('clustersize') + homogenization_RGC_Ngrains(1,i) = IO_intValue(line,positions,2_pInt) + homogenization_RGC_Ngrains(2,i) = IO_intValue(line,positions,3_pInt) + homogenization_RGC_Ngrains(3,i) = IO_intValue(line,positions,4_pInt) + case ('scalingparameter') + homogenization_RGC_xiAlpha(i) = IO_floatValue(line,positions,2_pInt) + case ('overproportionality') + homogenization_RGC_ciAlpha(i) = IO_floatValue(line,positions,2_pInt) + case ('grainsize') + homogenization_RGC_dAlpha(1,i) = IO_floatValue(line,positions,2_pInt) + homogenization_RGC_dAlpha(2,i) = IO_floatValue(line,positions,3_pInt) + homogenization_RGC_dAlpha(3,i) = IO_floatValue(line,positions,4_pInt) + case ('clusterorientation') + homogenization_RGC_angles(1,i) = IO_floatValue(line,positions,2_pInt) + homogenization_RGC_angles(2,i) = IO_floatValue(line,positions,3_pInt) + homogenization_RGC_angles(3,i) = IO_floatValue(line,positions,4_pInt) + end select + endif endif enddo !-------------------------------------------------------------------------------------------------- ! assigning cluster orientations elementLooping: do e = 1_pInt,mesh_NcpElems - if (homogenization_type(mesh_element(3,e)) == homogenization_RGC_label) then + if (homogenization_type(mesh_element(3,e)) == HOMOGENIZATION_RGC_label) then myInstance = homogenization_typeInstance(mesh_element(3,e)) if (all (homogenization_RGC_angles(:,myInstance) >= 399.9_pReal)) then homogenization_RGC_orientation(1:3,1:3,1,e) = math_EulerToR(math_sampleRandomOri()) diff --git a/code/homogenization_isostrain.f90 b/code/homogenization_isostrain.f90 index b08b1a40a..914e2e3dc 100644 --- a/code/homogenization_isostrain.f90 +++ b/code/homogenization_isostrain.f90 @@ -30,7 +30,7 @@ module homogenization_isostrain implicit none private character (len=*), parameter, public :: & - homogenization_isostrain_label = 'isostrain' + HOMOGENIZATION_ISOSTRAIN_label = 'isostrain' integer(pInt), dimension(:), allocatable, public :: & homogenization_isostrain_sizeState, & @@ -72,12 +72,12 @@ subroutine homogenization_isostrain_init(myFile) tag = '', & line = '' ! to start initialized - write(6,'(/,a)') ' <<<+- homogenization_'//trim(homogenization_isostrain_label)//' init -+>>>' + write(6,'(/,a)') ' <<<+- homogenization_'//HOMOGENIZATION_ISOSTRAIN_label//' init -+>>>' write(6,'(a)') ' $Id$' write(6,'(a15,a)') ' Current time: ',IO_timeStamp() #include "compilation_info.f90" - maxNinstance = count(homogenization_type == homogenization_isostrain_label) + maxNinstance = count(homogenization_type == HOMOGENIZATION_ISOSTRAIN_label) if (maxNinstance == 0) return allocate(homogenization_isostrain_sizeState(maxNinstance)) ; homogenization_isostrain_sizeState = 0_pInt @@ -104,19 +104,21 @@ subroutine homogenization_isostrain_init(myFile) section = section + 1_pInt output = 0_pInt ! reset output counter endif - if (section > 0 .and. homogenization_type(section) == homogenization_isostrain_label) then ! one of my sections - i = homogenization_typeInstance(section) ! which instance of my type is present homogenization - positions = IO_stringPos(line,maxNchunks) - tag = IO_lc(IO_stringValue(line,positions,1_pInt)) ! extract key - select case(tag) - case ('(output)') - output = output + 1_pInt - homogenization_isostrain_output(output,i) = IO_lc(IO_stringValue(line,positions,2_pInt)) - case ('ngrains') - homogenization_isostrain_Ngrains(i) = IO_intValue(line,positions,2_pInt) - case ('mapping') - homogenization_isostrain_mapping(i) = IO_lc(IO_stringValue(line,positions,2_pInt)) - end select + if (section > 0_pInt ) then ! do not short-circuit here (.and. with next if-statement). It's not safe in Fortran + if (trim(homogenization_type(section)) == HOMOGENIZATION_ISOSTRAIN_label) then ! one of my sections + i = homogenization_typeInstance(section) ! which instance of my type is present homogenization + positions = IO_stringPos(line,maxNchunks) + tag = IO_lc(IO_stringValue(line,positions,1_pInt)) ! extract key + select case(tag) + case ('(output)') + output = output + 1_pInt + homogenization_isostrain_output(output,i) = IO_lc(IO_stringValue(line,positions,2_pInt)) + case ('ngrains') + homogenization_isostrain_Ngrains(i) = IO_intValue(line,positions,2_pInt) + case ('mapping') + homogenization_isostrain_mapping(i) = IO_lc(IO_stringValue(line,positions,2_pInt)) + end select + endif endif enddo diff --git a/code/lattice.f90 b/code/lattice.f90 index aab029f4c..a806d68a5 100644 --- a/code/lattice.f90 +++ b/code/lattice.f90 @@ -33,12 +33,12 @@ module lattice implicit none private integer(pInt), parameter, public :: & - lattice_maxNslipFamily = 6_pInt, & !< max # of slip system families over lattice structures - lattice_maxNtwinFamily = 4_pInt, & !< max # of twin system families over lattice structures - lattice_maxNslip = 33_pInt, & !< max # of slip systems over lattice structures - lattice_maxNtwin = 24_pInt, & !< max # of twin systems over lattice structures - lattice_maxNinteraction = 42_pInt, & !< max # of interaction types (in hardening matrix part) - lattice_maxNnonSchmid = 6_pInt !< max # of non schmid contributions over lattice structures + LATTICE_maxNslipFamily = 6_pInt, & !< max # of slip system families over lattice structures + LATTICE_maxNtwinFamily = 4_pInt, & !< max # of twin system families over lattice structures + LATTICE_maxNslip = 33_pInt, & !< max # of slip systems over lattice structures + LATTICE_maxNtwin = 24_pInt, & !< max # of twin systems over lattice structures + LATTICE_maxNinteraction = 42_pInt, & !< max # of interaction types (in hardening matrix part) + LATTICE_maxNnonSchmid = 6_pInt !< max # of non schmid contributions over lattice structures integer(pInt), allocatable, dimension(:,:), protected, public :: & lattice_NslipSystem, & !< total # of slip systems in each family