From ef8b672a00618777b8ddfee8dd8c83f4b9faf036 Mon Sep 17 00:00:00 2001 From: Christoph Kords Date: Thu, 18 Jun 2009 14:28:02 +0000 Subject: [PATCH] numerics.config is now optional; if this file does not exist in the working directory, standard values from numerics.f90 are used; either way the output file tells which values were taken. added some output to the init subroutines of debug.f90, FEsolving.f90, lattice.f90, material.f90 and mesh.f90. --- trunk/FEsolving.f90 | 6 +- trunk/debug.f90 | 4 + trunk/lattice.f90 | 4 + trunk/material.f90 | 6 +- trunk/mesh.f90 | 4 + trunk/numerics.config | 34 +++++---- trunk/numerics.f90 | 167 ++++++++++++++++++++++++------------------ 7 files changed, 137 insertions(+), 88 deletions(-) diff --git a/trunk/FEsolving.f90 b/trunk/FEsolving.f90 index aa5c32481..ac2a334e6 100644 --- a/trunk/FEsolving.f90 +++ b/trunk/FEsolving.f90 @@ -32,6 +32,10 @@ integer(pInt), dimension(1+2*maxNchunks) :: positions character(len=1024) line + write(6,*) + write(6,*) '<<<+- FEsolving init -+>>>' + write(6,*) + if (IO_open_inputFile(fileunit)) then rewind(fileunit) @@ -50,7 +54,7 @@ endif 100 close(fileunit) - + return end subroutine diff --git a/trunk/debug.f90 b/trunk/debug.f90 index af4dbce09..c10b3de61 100644 --- a/trunk/debug.f90 +++ b/trunk/debug.f90 @@ -25,6 +25,10 @@ subroutine debug_init() nState, & nCryst implicit none + + write(6,*) + write(6,*) '<<<+- debug init -+>>>' + write(6,*) allocate(debug_StressLoopDistribution(nStress)) ; debug_StressLoopDistribution = 0_pInt allocate(debug_StateLoopDistribution(nState)) ; debug_StateLoopDistribution = 0_pInt diff --git a/trunk/lattice.f90 b/trunk/lattice.f90 index 17176db56..37df1b9b3 100644 --- a/trunk/lattice.f90 +++ b/trunk/lattice.f90 @@ -592,6 +592,10 @@ subroutine lattice_init() integer(pInt), parameter :: fileunit = 200 integer(pInt) i,Nsections + write(6,*) + write(6,*) '<<<+- lattice init -+>>>' + write(6,*) + if(.not. IO_open_file(fileunit,material_configFile)) call IO_error (100) ! corrupt config file Nsections = IO_countSections(fileunit,material_partPhase) lattice_Nstructure = 2_pInt + sum(IO_countTagInPart(fileunit,material_partPhase,'covera_ratio',Nsections)) ! fcc + bcc + all hex diff --git a/trunk/material.f90 b/trunk/material.f90 index 1e9e4c42a..8d6f7bd92 100644 --- a/trunk/material.f90 +++ b/trunk/material.f90 @@ -72,7 +72,11 @@ subroutine material_init() !* Definition of variables integer(pInt), parameter :: fileunit = 200 integer(pInt) i - + + write(6,*) + write(6,*) '<<<+- material init -+>>>' + write(6,*) + if(.not. IO_open_file(fileunit,material_configFile)) call IO_error (100) ! corrupt config file call material_parseHomogenization(fileunit,material_partHomogenization) call material_parseMicrostructure(fileunit,material_partMicrostructure) diff --git a/trunk/mesh.f90 b/trunk/mesh.f90 index 742e967f2..4f168a8c0 100644 --- a/trunk/mesh.f90 +++ b/trunk/mesh.f90 @@ -191,6 +191,10 @@ integer(pInt), parameter :: fileUnit = 222 integer(pInt) e + + write(6,*) + write(6,*) '<<<+- mesh init -+>>>' + write(6,*) mesh_Nelems = 0_pInt mesh_NcpElems = 0_pInt diff --git a/trunk/numerics.config b/trunk/numerics.config index 3891604bb..76ba6c041 100644 --- a/trunk/numerics.config +++ b/trunk/numerics.config @@ -1,18 +1,20 @@ -relevantStrain 1.0e-7 -iJacoStiffness 1 -iJacoLpresiduum 1 -pert_Fg 1.0e-6 -nHomog 10 -nCryst 20 -nState 10 -nStress 40 -subStepMin 1.0e-3 -rTol_crystalliteState 1.0e-6 -rTol_crystalliteStress 1.0e-6 -aTol_crystalliteStress 1.0e-8 +### numerical parameters ### -resToler 1.0e-4 -resAbsol 1.0e+2 -resBound 1.0e+1 -NRiterMax 24 \ No newline at end of file +relevantStrain 1.0e-7 # strain increment considered significant +iJacoStiffness 1 # frequency of stiffness update +iJacoLpresiduum 1 # frequency of Jacobian update of residuum in Lp +pert_Fg 1.0e-6 # strain perturbation for FEM Jacobi +nHomog 10 # homogenization loop limit +nCryst 20 # crystallite loop limit (only for debugging info, real loop limit is "subStepMin") +nState 10 # state loop limit +nStress 40 # stress loop limit +subStepMin 1.0e-3 # minimum (relative) size of sub-step allowed during cutback in crystallite +rTol_crystalliteState 1.0e-6 # relative tolerance in crystallite state loop +rTol_crystalliteStress 1.0e-6 # relative tolerance in crystallite stress loop +aTol_crystalliteStress 1.0e-8 # absolute tolerance in crystallite stress loop + +resToler 1.0e-4 # relative tolerance of residual in GIA iteration +resAbsol 1.0e+2 # absolute tolerance of residual in GIA iteration (corresponds to ~1 Pa) +resBound 1.0e+1 # relative maximum value (upper bound) for GIA residual +NRiterMax 24 # maximum number of GIA iteration \ No newline at end of file diff --git a/trunk/numerics.f90 b/trunk/numerics.f90 index c60140e70..9754e806c 100644 --- a/trunk/numerics.f90 +++ b/trunk/numerics.f90 @@ -74,71 +74,105 @@ subroutine numerics_init() ! resBound ! NRiterMax - ! initialize all values to zero - relevantStrain = 0.0_pReal - iJacoStiffness = 0_pInt - iJacoLpresiduum = 0_pInt - pert_Fg = 0.0_pReal - nHomog = 0_pInt - nCryst = 0_pInt - nState = 0_pInt - nStress = 0_pInt - subStepMin = 0.0_pReal - rTol_crystalliteState = 0.0_pReal - rTol_crystalliteStress = 0.0_pReal - aTol_crystalliteStress = 0.0_pReal - resToler = 0.0_pReal - resAbsol = 0.0_pReal - resBound = 0.0_pReal - NRiterMax = 0_pInt + write(6,*) + write(6,*) '<<<+- numerics init -+>>>' + write(6,*) + + ! initialize all parameters with standard values + relevantStrain = 1.0e-7_pReal + iJacoStiffness = 1_pInt + iJacoLpresiduum = 1_pInt + pert_Fg = 1.0e-6_pReal + nHomog = 10_pInt + nCryst = 20_pInt + nState = 10_pInt + nStress = 40_pInt + subStepMin = 1.0e-3_pReal + rTol_crystalliteState = 1.0e-6_pReal + rTol_crystalliteStress = 1.0e-6_pReal + aTol_crystalliteStress = 1.0e-8_pReal + resToler = 1.0e-4_pReal + resAbsol = 1.0e+2_pReal + resBound = 1.0e+1_pReal + NRiterMax = 24_pInt - ! try to open the config file and call error if corrupt - if(.not. IO_open_file(fileunit,numerics_configFile)) call IO_error (100) - - line = '' - ! read variables from config file - do - read(fileunit,'(a1024)',END=100) line - if (IO_isBlank(line)) cycle ! skip empty lines - positions = IO_stringPos(line,maxNchunks) - tag = IO_lc(IO_stringValue(line,positions,1)) ! extract key - select case(tag) - case ('relevantstrain') - relevantStrain = IO_floatValue(line,positions,2) - case ('ijacostiffness') - iJacoStiffness = IO_intValue(line,positions,2) - case ('ijacolpresiduum') - iJacoLpresiduum = IO_intValue(line,positions,2) - case ('pert_fg') - pert_Fg = IO_floatValue(line,positions,2) - case ('nhomog') - nHomog = IO_intValue(line,positions,2) - case ('ncryst') - nCryst = IO_intValue(line,positions,2) - case ('nstate') - nState = IO_intValue(line,positions,2) - case ('nstress') - nStress = IO_intValue(line,positions,2) - case ('substepmin') - subStepMin = IO_floatValue(line,positions,2) - case ('rtol_crystallitestate') - rTol_crystalliteState = IO_floatValue(line,positions,2) - case ('rtol_crystallitestress') - rTol_crystalliteStress = IO_floatValue(line,positions,2) - case ('atol_crystallitestress') - aTol_crystalliteStress = IO_floatValue(line,positions,2) - case ('restoler') - resToler = IO_floatValue(line,positions,2) - case ('resabsol') - resAbsol = IO_floatValue(line,positions,2) - case ('resbound') - resBound = IO_floatValue(line,positions,2) - case ('nritermax') - NRiterMax = IO_intValue(line,positions,2) - end select - enddo + ! try to open the config file + if(IO_open_file(fileunit,numerics_configFile)) then + + write(6,*) ' ... using values from config file' + write(6,*) + + line = '' + ! read variables from config file and overwrite parameters + do + read(fileunit,'(a1024)',END=100) line + if (IO_isBlank(line)) cycle ! skip empty lines + positions = IO_stringPos(line,maxNchunks) + tag = IO_lc(IO_stringValue(line,positions,1)) ! extract key + select case(tag) + case ('relevantstrain') + relevantStrain = IO_floatValue(line,positions,2) + case ('ijacostiffness') + iJacoStiffness = IO_intValue(line,positions,2) + case ('ijacolpresiduum') + iJacoLpresiduum = IO_intValue(line,positions,2) + case ('pert_fg') + pert_Fg = IO_floatValue(line,positions,2) + case ('nhomog') + nHomog = IO_intValue(line,positions,2) + case ('ncryst') + nCryst = IO_intValue(line,positions,2) + case ('nstate') + nState = IO_intValue(line,positions,2) + case ('nstress') + nStress = IO_intValue(line,positions,2) + case ('substepmin') + subStepMin = IO_floatValue(line,positions,2) + case ('rtol_crystallitestate') + rTol_crystalliteState = IO_floatValue(line,positions,2) + case ('rtol_crystallitestress') + rTol_crystalliteStress = IO_floatValue(line,positions,2) + case ('atol_crystallitestress') + aTol_crystalliteStress = IO_floatValue(line,positions,2) + case ('restoler') + resToler = IO_floatValue(line,positions,2) + case ('resabsol') + resAbsol = IO_floatValue(line,positions,2) + case ('resbound') + resBound = IO_floatValue(line,positions,2) + case ('nritermax') + NRiterMax = IO_intValue(line,positions,2) + endselect + enddo + 100 close(fileunit) + + ! no config file, so we use standard values + else + + write(6,*) ' ... using standard values' + write(6,*) + + endif - 100 write(6,*) + ! writing parameters to output file + write(6,'(a24,x,e8.1)') 'relevantStrain: ',relevantStrain + write(6,'(a24,x,i8)') 'iJacoStiffness: ',iJacoStiffness + write(6,'(a24,x,i8)') 'iJacoLpresiduum: ',iJacoLpresiduum + write(6,'(a24,x,e8.1)') 'pert_Fg: ',pert_Fg + write(6,'(a24,x,i8)') 'nHomog: ',nHomog + write(6,'(a24,x,i8)') 'nCryst: ',nCryst + write(6,'(a24,x,i8)') 'nState: ',nState + write(6,'(a24,x,i8)') 'nStress: ',nStress + write(6,'(a24,x,e8.1)') 'subStepMin: ',subStepMin + write(6,'(a24,x,e8.1)') 'rTol_crystalliteState: ',rTol_crystalliteState + write(6,'(a24,x,e8.1)') 'rTol_crystalliteStress: ',rTol_crystalliteStress + write(6,'(a24,x,e8.1)') 'aTol_crystalliteStress: ',aTol_crystalliteStress + write(6,'(a24,x,e8.1)') 'resToler: ',resToler + write(6,'(a24,x,e8.1)') 'resAbsol: ',resAbsol + write(6,'(a24,x,e8.1)') 'resBound: ',resBound + write(6,'(a24,x,i8)') 'NRiterMax: ',NRiterMax + write(6,*) + ! sanity check if (relevantStrain <= 0.0_pReal) call IO_error(260) if (iJacoStiffness < 1_pInt) call IO_error(261) @@ -156,13 +190,6 @@ subroutine numerics_init() if (resAbsol <= 0.0_pReal) call IO_error(273) if (resBound <= 0.0_pReal) call IO_error(274) if (NRiterMax < 1_pInt) call IO_error(275) - - close(fileunit) - - write(6,*) - write(6,*) '<<<+- numerics init -+>>>' - write(6,*) '...done' - write(6,*) endsubroutine