From d595f59f0ed60350433371f157f2b1db4b5b3fa3 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Fri, 20 Dec 2013 08:36:15 +0000 Subject: [PATCH] improved sanity checks, mainly for RGC --- code/constitutive_j2.f90 | 46 +++++++++++++------------------ code/constitutive_none.f90 | 13 +++------ code/homogenization_RGC.f90 | 15 +++++----- code/homogenization_isostrain.f90 | 2 +- 4 files changed, 32 insertions(+), 44 deletions(-) diff --git a/code/constitutive_j2.f90 b/code/constitutive_j2.f90 index befc18f64..c66bf0676 100644 --- a/code/constitutive_j2.f90 +++ b/code/constitutive_j2.f90 @@ -151,8 +151,8 @@ subroutine constitutive_j2_init(fileUnit) if (iand(debug_level(debug_constitutive),debug_levelBasic) /= 0_pInt) & write(6,'(a16,1x,i5,/)') '# instances:',maxNinstance - allocate(constitutive_j2_sizeDotState(maxNinstance), source=0_pInt) - allocate(constitutive_j2_sizeState(maxNinstance), source=0_pInt) + allocate(constitutive_j2_sizeDotState(maxNinstance), source=1_pInt) + allocate(constitutive_j2_sizeState(maxNinstance), source=1_pInt) allocate(constitutive_j2_sizePostResults(maxNinstance), source=0_pInt) allocate(constitutive_j2_sizePostResult(maxval(phase_Noutput), maxNinstance),source=0_pInt) allocate(constitutive_j2_output(maxval(phase_Noutput), maxNinstance)) @@ -198,7 +198,6 @@ subroutine constitutive_j2_init(fileUnit) tag = IO_lc(IO_stringValue(line,positions,1_pInt)) ! extract key select case(tag) case ('plasticity','elasticity') - cycle case ('(output)') constitutive_j2_Noutput(i) = constitutive_j2_Noutput(i) + 1_pInt constitutive_j2_output(constitutive_j2_Noutput(i),i) = & @@ -245,16 +244,24 @@ subroutine constitutive_j2_init(fileUnit) constitutive_j2_Cslip_66(6,6,i) = IO_floatValue(line,positions,2_pInt) case ('tau0') constitutive_j2_tau0(i) = IO_floatValue(line,positions,2_pInt) + if (constitutive_j2_tau0(i) < 0.0_pReal) & + call IO_error(211_pInt,ext_msg=trim(tag)//' ('//PLASTICITY_J2_label//')') case ('gdot0') constitutive_j2_gdot0(i) = IO_floatValue(line,positions,2_pInt) + if (constitutive_j2_gdot0(i) <= 0.0_pReal) & + call IO_error(211_pInt,ext_msg=trim(tag)//' ('//PLASTICITY_J2_label//')') case ('n') constitutive_j2_n(i) = IO_floatValue(line,positions,2_pInt) + if (constitutive_j2_n(i) <= 0.0_pReal) & + call IO_error(211_pInt,ext_msg=trim(tag)//' ('//PLASTICITY_J2_label//')') case ('h0') constitutive_j2_h0(i) = IO_floatValue(line,positions,2_pInt) case ('h0_slope','slopelnrate') constitutive_j2_h0_slopeLnRate(i) = IO_floatValue(line,positions,2_pInt) case ('tausat') constitutive_j2_tausat(i) = IO_floatValue(line,positions,2_pInt) + if (constitutive_j2_tausat(i) <= 0.0_pReal) & + call IO_error(211_pInt,ext_msg=trim(tag)//' ('//PLASTICITY_J2_label//')') case ('tausat_sinhfita') constitutive_j2_tausat_SinhFitA(i) = IO_floatValue(line,positions,2_pInt) case ('tausat_sinhfitb') @@ -265,10 +272,16 @@ subroutine constitutive_j2_init(fileUnit) constitutive_j2_tausat_SinhFitD(i) = IO_floatValue(line,positions,2_pInt) case ('a', 'w0') constitutive_j2_a(i) = IO_floatValue(line,positions,2_pInt) + if (constitutive_j2_a(i) <= 0.0_pReal) & + call IO_error(211_pInt,ext_msg=trim(tag)//' ('//PLASTICITY_J2_label//')') case ('taylorfactor') constitutive_j2_fTaylor(i) = IO_floatValue(line,positions,2_pInt) + if (constitutive_j2_fTaylor(i) <= 0.0_pReal) & + call IO_error(211_pInt,ext_msg=trim(tag)//' ('//PLASTICITY_J2_label//')') case ('atol_resistance') constitutive_j2_aTolResistance(i) = IO_floatValue(line,positions,2_pInt) + if (constitutive_j2_aTolResistance(i) <= 0.0_pReal) & + call IO_error(211_pInt,ext_msg=trim(tag)//' ('//PLASTICITY_J2_label//')') case default call IO_error(210_pInt,ext_msg=trim(tag)//' ('//PLASTICITY_J2_label//')') end select @@ -276,23 +289,6 @@ subroutine constitutive_j2_init(fileUnit) endif enddo - sanityChecks: do i = 1_pInt,maxNinstance - if (constitutive_j2_tau0(i) < 0.0_pReal) call IO_error(211_pInt,ext_msg='tau0 (' & - //PLASTICITY_J2_label//')') - if (constitutive_j2_gdot0(i) <= 0.0_pReal) call IO_error(211_pInt,ext_msg='gdot0 (' & - //PLASTICITY_J2_label//')') - if (constitutive_j2_n(i) <= 0.0_pReal) call IO_error(211_pInt,ext_msg='n (' & - //PLASTICITY_J2_label//')') - if (constitutive_j2_tausat(i) <= 0.0_pReal) call IO_error(211_pInt,ext_msg='tausat (' & - //PLASTICITY_J2_label//')') - if (constitutive_j2_a(i) <= 0.0_pReal) call IO_error(211_pInt,ext_msg='a (' & - //PLASTICITY_J2_label//')') - if (constitutive_j2_fTaylor(i) <= 0.0_pReal) call IO_error(211_pInt,ext_msg='taylorfactor (' & - //PLASTICITY_J2_label//')') - if (constitutive_j2_aTolResistance(i) <= 0.0_pReal) call IO_error(211_pInt,ext_msg='aTol_resistance (' & - //PLASTICITY_J2_label//')') - enddo sanityChecks - instancesLoop: do i = 1_pInt,maxNinstance outputsLoop: do o = 1_pInt,constitutive_j2_Noutput(i) select case(constitutive_j2_outputID(o,i)) @@ -308,14 +304,10 @@ subroutine constitutive_j2_init(fileUnit) endif enddo outputsLoop - constitutive_j2_sizeDotState(i) = 1_pInt - constitutive_j2_sizeState(i) = 1_pInt - - constitutive_j2_Cslip_66(1:6,1:6,i) = lattice_symmetrizeC66(constitutive_j2_structureID(i),& - constitutive_j2_Cslip_66(1:6,1:6,i)) constitutive_j2_Cslip_66(1:6,1:6,i) = & - math_Mandel3333to66(math_Voigt66to3333(constitutive_j2_Cslip_66(1:6,1:6,i))) ! Literature data is Voigt, DAMASK uses Mandel - + lattice_symmetrizeC66(constitutive_j2_structureID(i),constitutive_j2_Cslip_66(1:6,1:6,i)) + constitutive_j2_Cslip_66(1:6,1:6,i) = & ! Literature data is Voigt, DAMASK uses Mandel + math_Mandel3333to66(math_Voigt66to3333(constitutive_j2_Cslip_66(1:6,1:6,i))) enddo instancesLoop end subroutine constitutive_j2_init diff --git a/code/constitutive_none.f90 b/code/constitutive_none.f90 index e78c355af..3f0943582 100644 --- a/code/constitutive_none.f90 +++ b/code/constitutive_none.f90 @@ -112,8 +112,8 @@ subroutine constitutive_none_init(fileUnit) if (iand(debug_level(debug_constitutive),debug_levelBasic) /= 0_pInt) & write(6,'(a16,1x,i5,/)') '# instances:',maxNinstance - allocate(constitutive_none_sizeDotState(maxNinstance), source=0_pInt) - allocate(constitutive_none_sizeState(maxNinstance), source=0_pInt) + allocate(constitutive_none_sizeDotState(maxNinstance), source=1_pInt) + allocate(constitutive_none_sizeState(maxNinstance), source=1_pInt) allocate(constitutive_none_sizePostResults(maxNinstance), source=0_pInt) allocate(constitutive_none_structureID(maxNinstance), source=LATTICE_undefined_ID) allocate(constitutive_none_Cslip_66(6,6,maxNinstance), source=0.0_pReal) @@ -141,7 +141,6 @@ subroutine constitutive_none_init(fileUnit) tag = IO_lc(IO_stringValue(line,positions,1_pInt)) ! extract key select case(tag) case ('plasticity','elasticity') - cycle case ('lattice_structure') structure = IO_lc(IO_stringValue(line,positions,2_pInt)) select case(structure(1:3)) @@ -182,14 +181,10 @@ subroutine constitutive_none_init(fileUnit) enddo instancesLoop: do i = 1_pInt,maxNinstance - constitutive_none_sizeDotState(i) = 1_pInt - constitutive_none_sizeState(i) = 1_pInt - - constitutive_none_Cslip_66(1:6,1:6,i) = lattice_symmetrizeC66(constitutive_none_structureID(i),& - constitutive_none_Cslip_66(1:6,1:6,i)) constitutive_none_Cslip_66(1:6,1:6,i) = & + lattice_symmetrizeC66(constitutive_none_structureID(i),constitutive_none_Cslip_66(1:6,1:6,i)) + constitutive_none_Cslip_66(1:6,1:6,i) = & ! Literature data is Voigt, DAMASK uses Mandel math_Mandel3333to66(math_Voigt66to3333(constitutive_none_Cslip_66(1:6,1:6,i))) - enddo instancesLoop end subroutine constitutive_none_init diff --git a/code/homogenization_RGC.f90 b/code/homogenization_RGC.f90 index f9d242610..43362f3c3 100644 --- a/code/homogenization_RGC.f90 +++ b/code/homogenization_RGC.f90 @@ -118,7 +118,7 @@ subroutine homogenization_RGC_init(fileUnit) integer(pInt), intent(in) :: fileUnit !< file pointer to material configuration integer(pInt), parameter :: MAXNCHUNKS = 4_pInt integer(pInt), dimension(1_pInt+2_pInt*MAXNCHUNKS) :: positions - integer(pInt) ::section=0_pInt, maxNinstance, i,j,e, output=-1_pInt, mySize, myInstance + integer(pInt) :: section=0_pInt, maxNinstance, i,j,e, output=-1_pInt, mySize, myInstance character(len=65536) :: & tag = '', & line = '' @@ -169,8 +169,7 @@ subroutine homogenization_RGC_init(fileUnit) positions = IO_stringPos(line,MAXNCHUNKS) tag = IO_lc(IO_stringValue(line,positions,1_pInt)) ! extract key select case(tag) - case ('type') - cycle + case ('nconstituents','ngrains','type') case ('(output)') output = output + 1_pInt homogenization_RGC_output(output,i) = IO_lc(IO_stringValue(line,positions,2_pInt)) @@ -203,6 +202,8 @@ subroutine homogenization_RGC_init(fileUnit) 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) + if (homogenization_Ngrains(section) /= product(homogenization_RGC_Ngrains(1:3,i))) & + call IO_error(211_pInt,ext_msg=trim(tag)//' ('//HOMOGENIZATION_RGC_label//')') case ('scalingparameter') homogenization_RGC_xiAlpha(i) = IO_floatValue(line,positions,2_pInt) case ('overproportionality') @@ -1148,11 +1149,11 @@ subroutine homogenization_RGC_volumePenalty(vPen,vDiscrep,fDef,fAvg,ip,el) !-------------------------------------------------------------------------------------------------- ! compute the volumes of grains and of cluster - vDiscrep = math_det33(fAvg) ! compute the volume of the cluster + vDiscrep = math_det33(fAvg) ! compute the volume of the cluster do iGrain = 1_pInt,nGrain - gVol(iGrain) = math_det33(fDef(1:3,1:3,iGrain)) ! compute the volume of individual grains - vDiscrep = vDiscrep - gVol(iGrain)/real(nGrain,pReal) ! calculate the difference/dicrepancy between - ! the volume of the cluster and the the total volume of grains + gVol(iGrain) = math_det33(fDef(1:3,1:3,iGrain)) ! compute the volume of individual grains + vDiscrep = vDiscrep - gVol(iGrain)/real(nGrain,pReal) ! calculate the difference/dicrepancy between + ! the volume of the cluster and the the total volume of grains enddo !-------------------------------------------------------------------------------------------------- diff --git a/code/homogenization_isostrain.f90 b/code/homogenization_isostrain.f90 index 5403265a5..0c60e9442 100644 --- a/code/homogenization_isostrain.f90 +++ b/code/homogenization_isostrain.f90 @@ -131,7 +131,6 @@ subroutine homogenization_isostrain_init(fileUnit) tag = IO_lc(IO_stringValue(line,positions,1_pInt)) ! extract key select case(tag) case('type') - cycle case ('(output)') output = output + 1_pInt homogenization_isostrain_output(output,i) = IO_lc(IO_stringValue(line,positions,2_pInt)) @@ -159,6 +158,7 @@ subroutine homogenization_isostrain_init(fileUnit) case ('average','mean','avg') homogenization_isostrain_mapping(i) = average_ID case default + call IO_error(211_pInt,ext_msg=trim(tag)//' ('//HOMOGENIZATION_isostrain_label//')') end select case default call IO_error(210_pInt,ext_msg=trim(tag)//' ('//HOMOGENIZATION_isostrain_label//')')