better as local variables

This commit is contained in:
Sharan Roongta 2020-06-17 16:47:13 +02:00
parent e455dd4b9a
commit f6355d199a
5 changed files with 39 additions and 28 deletions

@ -1 +1 @@
Subproject commit a22650393972eeaf4fa20bb5a5fe69f853c211fa
Subproject commit 017b38d79deb4720368927b8a884527e2b331c23

View File

@ -61,6 +61,7 @@ program DAMASK_grid
i, j, k, l, field, &
errorID = 0, &
cutBackLevel = 0, & !< cut back level \f$ t = \frac{t_{inc}}{2^l} \f$
maxCutBack, & !< max number of cut backs
stepFraction = 0 !< fraction of current time interval
integer :: &
currentLoadcase = 0, & !< current load case
@ -68,6 +69,7 @@ program DAMASK_grid
totalIncsCounter = 0, & !< total # of increments
statUnit = 0, & !< file unit for statistics output
stagIter, &
stagItMax, & !< max number of field level staggered iterations
nActiveFields = 0
character(len=pStringLen), dimension(:), allocatable :: fileContent
character(len=pStringLen) :: &
@ -90,7 +92,8 @@ program DAMASK_grid
external :: &
quit
class (tNode), pointer :: &
num_grid
num_grid, &
num_generic
!--------------------------------------------------------------------------------------------------
! init DAMASK (all modules)
@ -145,6 +148,15 @@ program DAMASK_grid
end select
!-------------------------------------------------------------------------------------------------
! reading field paramters from numerics file and do sanity checks
num_generic => numerics_root%get('generic', defaultVal=emptyDict)
stagItMax = num_generic%get_asInt('maxStaggeredIter',defaultVal=10)
maxCutBack = num_generic%get_asInt('maxCutBack',defaultVal=3)
if (stagItMax < 0) call IO_error(301,ext_msg='maxStaggeredIter')
if (maxCutBack < 0) call IO_error(301,ext_msg='maxCutBack')
!--------------------------------------------------------------------------------------------------
! reading information from load case file and to sanity checks
fileContent = IO_readlines(trim(loadCaseFile))

View File

@ -13,6 +13,7 @@ module discretization_marc
use IO
use debug
use numerics
use YAML_types
use FEsolving
use element
use discretization
@ -58,7 +59,7 @@ subroutine discretization_marc_init
integer:: &
Nnodes, & !< total number of nodes in the mesh
Nelems !< total number of elements in the mesh
real(pReal), dimension(:,:), allocatable :: &
IP_reshaped
integer,dimension(:,:,:), allocatable :: &
@ -67,10 +68,15 @@ subroutine discretization_marc_init
connectivity_elem
real(pReal), dimension(:,:,:,:),allocatable :: &
unscaledNormals
class(tNode), pointer :: &
num_commercialFEM
write(6,'(/,a)') ' <<<+- discretization_marc init -+>>>'; flush(6)
mesh_unitlength = numerics_unitlength ! set physical extent of a length unit in mesh
num_commercialFEM => numerics_root%get('commercialFEM',defaultVal = emptyDict)
mesh_unitlength = num_commercialFEM%get_asFloat('unitlength',defaultVal=1.0_pReal) ! set physical extent of a length unit in mesh
if (mesh_unitlength <= 0.0_pReal) call IO_error(301,ext_msg='unitlength')
call inputRead(elem,node0_elem,connectivity_elem,microstructureAt,homogenizationAt)
nElems = size(connectivity_elem,2)

View File

@ -16,6 +16,7 @@ program DAMASK_mesh
use CPFEM2
use FEsolving
use numerics
use YAML_types
use discretization_mesh
use FEM_Utilities
use mesh_mech_FEM
@ -48,6 +49,7 @@ program DAMASK_mesh
i, &
errorID, &
cutBackLevel = 0, & !< cut back level \f$ t = \frac{t_{inc}}{2^l} \f$
maxCutBack, & !< max number of cutbacks
stepFraction = 0, & !< fraction of current time interval
currentLoadcase = 0, & !< current load case
currentFace = 0, &
@ -55,7 +57,10 @@ program DAMASK_mesh
totalIncsCounter = 0, & !< total # of increments
statUnit = 0, & !< file unit for statistics output
stagIter, &
stagItMax, & !< max number of field level staggered iterations
component
class(tNode), pointer :: &
num_generic
character(len=pStringLen), dimension(:), allocatable :: fileContent
character(len=pStringLen) :: &
incInfo, &
@ -72,7 +77,16 @@ program DAMASK_mesh
! init DAMASK (all modules)
call CPFEM_initAll
write(6,'(/,a)') ' <<<+- DAMASK_FEM init -+>>>'; flush(6)
!---------------------------------------------------------------------
! reading field information from numerics file and do sanity checks
num_generic => numerics_root%get('generic', defaultVal=emptyDict)
stagItMax = num_generic%get_asInt('maxStaggeredIter',defaultVal=10)
maxCutBack = num_generic%get_asInt('maxCutBack',defaultVal=3)
if (stagItMax < 0) call IO_error(301,ext_msg='maxStaggeredIter')
if (maxCutBack < 0) call IO_error(301,ext_msg='maxCutBack')
! reading basic information from load case file and allocate data structure containing load cases
call DMGetDimension(geomMesh,dimPlex,ierr); CHKERRA(ierr) !< dimension of mesh (2D or 3D)
nActiveFields = 1

View File

@ -26,16 +26,13 @@ module numerics
integer(4), protected, public :: &
DAMASK_NumThreadsInt = 0 !< value stored in environment variable DAMASK_NUM_THREADS, set to zero if no OpenMP directive
real(pReal), protected, public :: &
numerics_unitlength = 1.0_pReal, & !< determines the physical length of one computational length unit
residualStiffness = 1.0e-6_pReal !< non-zero residual damage
!--------------------------------------------------------------------------------------------------
! field parameters:
integer, protected, public :: &
itmax = 250, & !< maximum number of iterations
itmin = 1, & !< minimum number of iterations
stagItMax = 10, & !< max number of field level staggered iterations
maxCutBack = 3 !< max number of cut backs
itmin = 1 !< minimum number of iterations
!--------------------------------------------------------------------------------------------------
! spectral parameters:
@ -108,10 +105,6 @@ subroutine numerics_init
itmax = num_grid%get_asInt(key)
case ('itmin')
itmin = num_grid%get_asInt(key)
case ('maxCutBack')
maxCutBack = num_grid%get_asInt(key)
case ('maxStaggeredIter')
stagItMax = num_grid%get_asInt(key)
#ifdef PETSC
case ('petsc_options')
petsc_options = num_grid%get_asString(key)
@ -123,11 +116,6 @@ subroutine numerics_init
do i=1,num_generic%length
key = num_generic%getKey(i)
select case(key)
case ('unitlength')
numerics_unitlength = num_generic%get_asFloat(key)
!--------------------------------------------------------------------------------------------------
! gradient parameter
case ('residualStiffness')
residualStiffness = num_generic%get_asFloat(key)
endselect
@ -138,10 +126,6 @@ subroutine numerics_init
flush(6)
endif fileExists
!--------------------------------------------------------------------------------------------------
! writing parameters to output
write(6,'(a24,1x,es8.1,/)')' unitlength: ',numerics_unitlength
!--------------------------------------------------------------------------------------------------
! gradient parameter
write(6,'(a24,1x,es8.1)') ' residualStiffness: ',residualStiffness
@ -154,8 +138,6 @@ subroutine numerics_init
! field parameters
write(6,'(a24,1x,i8)') ' itmax: ',itmax
write(6,'(a24,1x,i8)') ' itmin: ',itmin
write(6,'(a24,1x,i8)') ' maxCutBack: ',maxCutBack
write(6,'(a24,1x,i8)') ' maxStaggeredIter: ',stagItMax
!--------------------------------------------------------------------------------------------------
#ifdef PETSC
@ -164,12 +146,9 @@ subroutine numerics_init
!--------------------------------------------------------------------------------------------------
! sanity checks
if (numerics_unitlength <= 0.0_pReal) call IO_error(301,ext_msg='unitlength')
if (residualStiffness < 0.0_pReal) call IO_error(301,ext_msg='residualStiffness')
if (itmax <= 1) call IO_error(301,ext_msg='itmax')
if (itmin > itmax .or. itmin < 1) call IO_error(301,ext_msg='itmin')
if (maxCutBack < 0) call IO_error(301,ext_msg='maxCutBack')
if (stagItMax < 0) call IO_error(301,ext_msg='maxStaggeredIter')
end subroutine numerics_init