From 06f6e15123a674efce1b5b1c9d2f3adfa1c145f4 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Tue, 16 Jun 2020 07:02:29 +0200 Subject: [PATCH] avoid public variables --- src/CPFEM.f90 | 18 ++---------------- src/DAMASK_marc.f90 | 19 +++++++++++++++++-- 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/src/CPFEM.f90 b/src/CPFEM.f90 index 8c53eb9a4..d285a1e01 100644 --- a/src/CPFEM.f90 +++ b/src/CPFEM.f90 @@ -35,19 +35,9 @@ module CPFEM CPFEM_dcsdE !< Cauchy stress tangent real(pReal), dimension (:,:,:,:), allocatable, private :: & CPFEM_dcsdE_knownGood !< known good tangent - integer(pInt), public :: & - cycleCounter = 0_pInt, & !< needs description - theInc = -1_pInt, & !< needs description - lastLovl = 0_pInt !< lovl in previous call to marc hypela2 - real(pReal), public :: & - theTime = 0.0_pReal, & !< needs description - theDelta = 0.0_pReal - logical, public :: & - lastIncConverged = .false., & !< needs description - outdatedByNewInc = .false. !< needs description - logical, public, protected :: & - CPFEM_init_done = .false. !< remember whether init has been done already + integer(pInt), public :: & + cycleCounter = 0_pInt !< needs description integer(pInt), parameter, public :: & CPFEM_CALCRESULTS = 2_pInt**0_pInt, & @@ -68,7 +58,6 @@ contains !-------------------------------------------------------------------------------------------------- subroutine CPFEM_initAll - CPFEM_init_done = .true. call DAMASK_interface_init call prec_init call IO_init @@ -149,9 +138,6 @@ subroutine CPFEM_general(mode, ffn, ffn1, temperature_inp, dt, elFE, ip, cauchyS write(6,'(/,a)') '#############################################' write(6,'(a1,a22,1x,i8,a13)') '#','element', elCP, '#' write(6,'(a1,a22,1x,i8,a13)') '#','ip', ip, '#' - write(6,'(a1,a22,1x,f15.7,a6)') '#','theTime', theTime, '#' - write(6,'(a1,a22,1x,f15.7,a6)') '#','theDelta', theDelta, '#' - write(6,'(a1,a22,1x,i8,a13)') '#','theInc', theInc, '#' write(6,'(a1,a22,1x,i8,a13)') '#','cycleCounter', cycleCounter, '#' write(6,'(a1,a22,1x,i8,a13)') '#','computationMode',mode, '#' if (terminallyIll) & diff --git a/src/DAMASK_marc.f90 b/src/DAMASK_marc.f90 index 5349608c9..efa054dbf 100644 --- a/src/DAMASK_marc.f90 +++ b/src/DAMASK_marc.f90 @@ -42,6 +42,7 @@ module DAMASK_interface logical, protected, public :: symmetricSolver character(len=*), parameter, public :: INPUTFILEEXTENSION = '.dat' + public :: & DAMASK_interface_init, & @@ -241,6 +242,17 @@ subroutine hypela2(d,g,e,de,s,t,dt,ngens,m,nn,kcus,matus,ndi,nshear,disp, & real(pReal), dimension(6,6) :: ddsdde integer :: computationMode, i, cp_en, node, CPnodeID integer(4) :: defaultNumThreadsInt !< default value set by Marc + + integer(pInt), save :: & + theInc = -1_pInt, & !< needs description + lastLovl = 0_pInt !< lovl in previous call to marc hypela2 + real(pReal), save :: & + theTime = 0.0_pReal, & !< needs description + theDelta = 0.0_pReal + logical, save :: & + lastIncConverged = .false., & !< needs description + outdatedByNewInc = .false., & !< needs description + CPFEM_init_done = .false. !< remember whether init has been done already if (iand(debug_level(debug_MARC),debug_LEVELBASIC) /= 0) then write(6,'(a,/,i8,i8,i2)') ' MSC.MARC information on shape of element(2), IP:', m, nn @@ -260,14 +272,17 @@ subroutine hypela2(d,g,e,de,s,t,dt,ngens,m,nn,kcus,matus,ndi,nshear,disp, & defaultNumThreadsInt = omp_get_num_threads() ! remember number of threads set by Marc call omp_set_num_threads(1) ! no openMP - if (.not. CPFEM_init_done) call CPFEM_initAll + if (.not. CPFEM_init_done) then + CPFEM_init_done = .true. + call CPFEM_initAll + endif computationMode = 0 ! save initialization value, since it does not result in any calculation if (lovl == 4 ) then ! jacobian requested by marc if (timinc < theDelta .and. theInc == inc .and. lastLovl /= lovl) & ! first after cutback computationMode = CPFEM_RESTOREJACOBIAN elseif (lovl == 6) then ! stress requested by marc - computationMode = CPFEM_CALCRESULTS ! always calc + computationMode = CPFEM_CALCRESULTS cp_en = mesh_FEM2DAMASK_elem(m(1)) if (cptim > theTime .or. inc /= theInc) then ! reached "convergence" terminallyIll = .false.