diff --git a/code/DAMASK_abaqus_exp.f b/code/DAMASK_abaqus_exp.f index e407074e6..4de615896 100644 --- a/code/DAMASK_abaqus_exp.f +++ b/code/DAMASK_abaqus_exp.f @@ -106,6 +106,8 @@ subroutine vumat(nBlock, nDir, nshr, nStateV, nFieldV, nProps, lAnneal, & use prec, only: & pReal, & pInt +!$ use numerics, only: & +!$ DAMASK_NumThreadsInt use FEsolving, only: & cycleCounter, & theTime, & @@ -192,7 +194,14 @@ subroutine vumat(nBlock, nDir, nshr, nStateV, nFieldV, nProps, lAnneal, & real(pReal), dimension(6,6) :: ddsdde real(pReal) :: temp, timeInc integer(pInt) :: computationMode, n, i, cp_en + !$ integer :: defaultNumThreadsInt !< default value set by Abaqus + !$ include "omp_lib.h" + !$ defaultNumThreadsInt = omp_get_num_threads() ! remember number of threads set by Marc + !$ call omp_set_num_threads(DAMASK_NumThreadsInt) ! set number of threads for parallel execution set by DAMASK_NUM_THREADS + + enerInternNew = 0.0_pReal + enerInelasNew = 0.0_pReal computationMode = CPFEM_CALCRESULTS ! always calculate do n = 1,nblock(1) ! loop over vector of IPs temp = tempOld(n) @@ -279,6 +288,7 @@ subroutine vumat(nBlock, nDir, nshr, nStateV, nFieldV, nProps, lAnneal, & nBlock(2),mesh_FEasCP('elem', nBlock(4_pInt+n))) enddo + !$ call omp_set_num_threads(defaultNumThreadsInt) ! reset number of threads to stored default value end subroutine vumat diff --git a/code/DAMASK_abaqus_std.f b/code/DAMASK_abaqus_std.f index efea6ac92..6236701ae 100644 --- a/code/DAMASK_abaqus_std.f +++ b/code/DAMASK_abaqus_std.f @@ -101,11 +101,11 @@ subroutine UMAT(STRESS,STATEV,DDSDDE,SSE,SPD,SCD,& TIME,DTIME,TEMP,DTEMP,PREDEF,DPRED,CMNAME,NDI,NSHR,NTENS,& NSTATV,PROPS,NPROPS,COORDS,DROT,PNEWDT,CELENT,& DFGRD0,DFGRD1,NOEL,NPT,KSLAY,KSPT,KSTEP,KINC) - use prec, only: & pReal, & pInt use numerics, only: & +!$ DAMASK_NumThreadsInt, & usePingPong use FEsolving, only: & cycleCounter, & @@ -202,11 +202,16 @@ subroutine UMAT(STRESS,STATEV,DDSDDE,SSE,SPD,SCD,& real(pReal), dimension(6,6) :: ddsdde_h integer(pInt) :: computationMode, i, cp_en logical :: cutBack + !$ integer :: defaultNumThreadsInt !< default value set by Abaqus + !$ include "omp_lib.h" temperature = temp ! temp is intent(in) DDSDDT = 0.0_pReal DRPLDE = 0.0_pReal + !$ defaultNumThreadsInt = omp_get_num_threads() ! remember number of threads set by Marc + !$ call omp_set_num_threads(DAMASK_NumThreadsInt) ! set number of threads for parallel execution set by DAMASK_NUM_THREADS + if (iand(debug_level(debug_abaqus),debug_levelBasic) /= 0 .and. noel == 1 .and. npt == 1) then !$OMP CRITICAL (write2out) write(6,*) 'el',noel,'ip',npt @@ -342,6 +347,7 @@ subroutine UMAT(STRESS,STATEV,DDSDDE,SSE,SPD,SCD,& statev = materialpoint_results(1:min(nstatv,materialpoint_sizeResults),npt,mesh_FEasCP('elem', noel)) if ( terminallyIll ) pnewdt = 0.5_pReal ! force cutback directly ? + !$ call omp_set_num_threads(defaultNumThreadsInt) ! reset number of threads to stored default value end subroutine UMAT diff --git a/code/numerics.f90 b/code/numerics.f90 index 44fd00f9c..376e42cba 100644 --- a/code/numerics.f90 +++ b/code/numerics.f90 @@ -123,7 +123,7 @@ subroutine numerics_init IO_EOF #ifdef Spectral -!$ use OMP_LIB, only: omp_set_num_threads ! Use the standard conforming module file for omp if not using MSC.Marc +!$ use OMP_LIB, only: omp_set_num_threads ! Use the standard conforming module file for omp if using the spectral solver #endif implicit none #ifndef Spectral