diff --git a/code/CPFEM.f90 b/code/CPFEM.f90 index 6713ae113..4170345f2 100644 --- a/code/CPFEM.f90 +++ b/code/CPFEM.f90 @@ -45,7 +45,7 @@ contains !-------------------------------------------------------------------------------------------------- !> @brief call (thread safe) all module initializations !-------------------------------------------------------------------------------------------------- -subroutine CPFEM_initAll(temperature_inp,el,ip) +subroutine CPFEM_initAll(el,ip) use prec, only: & prec_init use numerics, only: & @@ -79,7 +79,6 @@ subroutine CPFEM_initAll(temperature_inp,el,ip) implicit none integer(pInt), intent(in) :: el, & !< FE el number ip !< FE integration point number - real(pReal), intent(in) :: temperature_inp !< temperature !$OMP CRITICAL (init) if (.not. CPFEM_init_done) then @@ -100,7 +99,7 @@ subroutine CPFEM_initAll(temperature_inp,el,ip) call material_init call constitutive_init call crystallite_init - call homogenization_init(temperature_inp) + call homogenization_init call CPFEM_init #if defined(Marc4DAMASK) || defined(Abaqus) call DAMASK_interface_init ! Spectral solver and FEM init is already done @@ -264,7 +263,7 @@ end subroutine CPFEM_init #if defined(Marc4DAMASK) || defined(Abaqus) subroutine CPFEM_general(mode, parallelExecution, ffn, ffn1, temperature_inp, dt, elFE, ip, cauchyStress, jacobian) #else -subroutine CPFEM_general(mode, ffn, ffn1, temperature_inp, dt, elFE, ip) +subroutine CPFEM_general(mode, ffn, ffn1, dt, elFE, ip) #endif use numerics, only: & defgradTolerance, & @@ -364,12 +363,12 @@ subroutine CPFEM_general(mode, ffn, ffn1, temperature_inp, dt, elFE, ip) implicit none integer(pInt), intent(in) :: elFE, & !< FE element number ip !< integration point number - real(pReal), intent(in) :: temperature_inp !< temperature real(pReal), intent(in) :: dt !< time increment real(pReal), dimension (3,3), intent(in) :: ffn, & !< deformation gradient for t=t0 ffn1 !< deformation gradient for t=t1 integer(pInt), intent(in) :: mode !< computation mode 1: regular computation plus aging of results #if defined(Marc4DAMASK) || defined(Abaqus) + real(pReal), intent(in) :: temperature_inp !< temperature logical, intent(in) :: parallelExecution !< flag indicating parallel computation of requested IPs real(pReal), dimension(6), intent(out) :: cauchyStress !< stress vector in Mandel notation real(pReal), dimension(6,6), intent(out) :: jacobian !< jacobian in Mandel notation (Consistent tangent dcs/dE) diff --git a/code/DAMASK_abaqus_exp.f b/code/DAMASK_abaqus_exp.f index e455a3e5f..9b3fe1d5f 100644 --- a/code/DAMASK_abaqus_exp.f +++ b/code/DAMASK_abaqus_exp.f @@ -186,7 +186,7 @@ subroutine vumat(nBlock, nDir, nshr, nStateV, nFieldV, nProps, lAnneal, & do n = 1,nblock(1) ! loop over vector of IPs temp = tempOld(n) ! temp is intent(in) if ( .not. CPFEM_init_done ) then - call CPFEM_initAll(temp,nBlock(4_pInt+n),nBlock(2)) + call CPFEM_initAll(nBlock(4_pInt+n),nBlock(2)) outdatedByNewInc = .false. if (iand(debug_level(debug_abaqus),debug_levelBasic) /= 0) then diff --git a/code/DAMASK_abaqus_std.f b/code/DAMASK_abaqus_std.f index 060ee2d17..48bebeb79 100644 --- a/code/DAMASK_abaqus_std.f +++ b/code/DAMASK_abaqus_std.f @@ -200,7 +200,7 @@ subroutine UMAT(STRESS,STATEV,DDSDDE,SSE,SPD,SCD,& flush(6) endif - if (.not. CPFEM_init_done) call CPFEM_initAll(temperature,noel,npt) + if (.not. CPFEM_init_done) call CPFEM_initAll(noel,npt) computationMode = 0 cp_en = mesh_FEasCP('elem',noel) diff --git a/code/DAMASK_marc.f90 b/code/DAMASK_marc.f90 index a5e605a57..3d531dcf8 100644 --- a/code/DAMASK_marc.f90 +++ b/code/DAMASK_marc.f90 @@ -253,7 +253,7 @@ 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 - if (.not. CPFEM_init_done) call CPFEM_initAll(t(1),m(1),nn) + if (.not. CPFEM_init_done) call CPFEM_initAll(m(1),nn) !$ call omp_set_num_threads(DAMASK_NumThreadsInt) ! set number of threads for parallel execution set by DAMASK_NUM_THREADS diff --git a/code/DAMASK_spectral_driver.f90 b/code/DAMASK_spectral_driver.f90 index febaa9394..c01a806a0 100644 --- a/code/DAMASK_spectral_driver.f90 +++ b/code/DAMASK_spectral_driver.f90 @@ -144,7 +144,7 @@ program DAMASK_spectral_Driver external :: quit !-------------------------------------------------------------------------------------------------- ! init DAMASK (all modules) - call CPFEM_initAll(temperature_inp = 300.0_pReal, el = 1_pInt, ip = 1_pInt) + call CPFEM_initAll(el = 1_pInt, ip = 1_pInt) mainProcess: if (worldrank == 0) then write(6,'(/,a)') ' <<<+- DAMASK_spectral_driver init -+>>>' write(6,'(a)') ' $Id$' @@ -245,8 +245,6 @@ program DAMASK_spectral_Driver loadCases(currentLoadCase)%P%values = math_plain9to33(temp_valueVector) case('t','time','delta') ! increment time loadCases(currentLoadCase)%time = IO_floatValue(line,positions,i+1_pInt) - case('temp','temperature') ! starting temperature - loadCases(currentLoadCase)%temperature = IO_floatValue(line,positions,i+1_pInt) case('n','incs','increments','steps') ! number of increments loadCases(currentLoadCase)%incs = IO_intValue(line,positions,i+1_pInt) case('logincs','logincrements','logsteps') ! number of increments (switch to log time scaling) @@ -329,7 +327,6 @@ program DAMASK_spectral_Driver if (any(loadCases(currentLoadCase)%rotation /= math_I3)) & write(6,'(2x,a,/,3(3(3x,f12.7,1x)/))',advance='no') 'rotation of loadframe:',& math_transpose33(loadCases(currentLoadCase)%rotation) - write(6,'(2x,a,f12.6)') 'temperature:', loadCases(currentLoadCase)%temperature if (loadCases(currentLoadCase)%time < 0.0_pReal) errorID = 834_pInt ! negative time increment write(6,'(2x,a,f12.6)') 'time: ', loadCases(currentLoadCase)%time if (loadCases(currentLoadCase)%incs < 1_pInt) errorID = 835_pInt ! non-positive incs count @@ -351,16 +348,16 @@ program DAMASK_spectral_Driver case(FIELD_MECH_ID) select case (spectral_solver) case (DAMASK_spectral_SolverBasicPETSc_label) - call basicPETSc_init(loadCases(1)%temperature) + call basicPETSc_init case (DAMASK_spectral_SolverAL_label) if(iand(debug_level(debug_spectral),debug_levelBasic)/= 0 .and. worldrank == 0_pInt) & call IO_warning(42_pInt, ext_msg='debug Divergence') - call AL_init(loadCases(1)%temperature) + call AL_init case (DAMASK_spectral_SolverPolarisation_label) if(iand(debug_level(debug_spectral),debug_levelBasic)/= 0 .and. worldrank == 0_pInt) & call IO_warning(42_pInt, ext_msg='debug Divergence') - call Polarisation_init(loadCases(1)%temperature) + call Polarisation_init case default call IO_error(error_ID = 891, ext_msg = trim(spectral_solver)) @@ -368,7 +365,7 @@ program DAMASK_spectral_Driver end select case(FIELD_THERMAL_ID) - call spectral_thermal_init(loadCases(1)%temperature) + call spectral_thermal_init case(FIELD_DAMAGE_ID) call spectral_damage_init() @@ -550,7 +547,6 @@ program DAMASK_spectral_Driver incInfo,guess,timeinc,timeIncOld,remainingLoadCaseTime, & P_BC = loadCases(currentLoadCase)%P, & F_BC = loadCases(currentLoadCase)%deformation, & - temperature_bc = loadCases(currentLoadCase)%temperature, & rotation_BC = loadCases(currentLoadCase)%rotation) case (DAMASK_spectral_SolverAL_label) @@ -558,7 +554,6 @@ program DAMASK_spectral_Driver incInfo,guess,timeinc,timeIncOld,remainingLoadCaseTime, & P_BC = loadCases(currentLoadCase)%P, & F_BC = loadCases(currentLoadCase)%deformation, & - temperature_bc = loadCases(currentLoadCase)%temperature, & rotation_BC = loadCases(currentLoadCase)%rotation) case (DAMASK_spectral_SolverPolarisation_label) @@ -566,7 +561,6 @@ program DAMASK_spectral_Driver incInfo,guess,timeinc,timeIncOld,remainingLoadCaseTime, & P_BC = loadCases(currentLoadCase)%P, & F_BC = loadCases(currentLoadCase)%deformation, & - temperature_bc = loadCases(currentLoadCase)%temperature, & rotation_BC = loadCases(currentLoadCase)%rotation) end select diff --git a/code/DAMASK_spectral_solverAL.f90 b/code/DAMASK_spectral_solverAL.f90 index 729d1e820..dcd674cb0 100644 --- a/code/DAMASK_spectral_solverAL.f90 +++ b/code/DAMASK_spectral_solverAL.f90 @@ -99,7 +99,7 @@ contains !> @brief allocates all neccessary fields and fills them with data, potentially from restart info !> @todo use sourced allocation, e.g. allocate(Fdot,source = F_lastInc) !-------------------------------------------------------------------------------------------------- -subroutine AL_init(temperature) +subroutine AL_init use, intrinsic :: iso_fortran_env ! to get compiler_version and compiler_options (at least for gfortran >4.6 at the moment) use IO, only: & IO_intOut, & @@ -127,8 +127,6 @@ subroutine AL_init(temperature) math_invSym3333 implicit none - real(pReal), intent(inout) :: & - temperature real(pReal), dimension(:,:,:,:,:), allocatable :: P real(pReal), dimension(3,3) :: & temp33_Real = 0.0_pReal @@ -224,7 +222,7 @@ subroutine AL_init(temperature) call utilities_updateIPcoords(F) call Utilities_constitutiveResponse(F_lastInc,F,& - temperature,0.0_pReal,P,C_volAvg,C_minMaxAvg,temp33_Real,.false.,math_I3) + 0.0_pReal,P,C_volAvg,C_minMaxAvg,temp33_Real,.false.,math_I3) nullify(F) nullify(F_lambda) call DMDAVecRestoreArrayF90(da,solution_vec,xx_psc,ierr); CHKERRQ(ierr) ! write data back to PETSc @@ -256,8 +254,7 @@ end subroutine AL_init !> @brief solution for the AL scheme with internal iterations !-------------------------------------------------------------------------------------------------- type(tSolutionState) function & - AL_solution(incInfoIn,guess,timeinc,timeinc_old,loadCaseTime,P_BC,F_BC,temperature_bc, & - rotation_BC) + AL_solution(incInfoIn,guess,timeinc,timeinc_old,loadCaseTime,P_BC,F_BC,rotation_BC) use numerics, only: & update_gamma use math, only: & @@ -277,8 +274,7 @@ type(tSolutionState) function & real(pReal), intent(in) :: & timeinc, & !< increment in time for current solution timeinc_old, & !< increment in time of last increment - loadCaseTime, & !< remaining time of current load case - temperature_bc + loadCaseTime !< remaining time of current load case logical, intent(in) :: & guess type(tBoundaryCondition), intent(in) :: & @@ -313,7 +309,6 @@ type(tSolutionState) function & params%rotation_BC = rotation_BC params%timeinc = timeinc params%timeincOld = timeinc_old - params%temperature = temperature_bc !-------------------------------------------------------------------------------------------------- ! solve BVP @@ -453,7 +448,7 @@ subroutine AL_formResidual(in,x_scal,f_scal,dummy,ierr) !-------------------------------------------------------------------------------------------------- ! evaluate constitutive response P_avLastEval = P_av - call Utilities_constitutiveResponse(F_lastInc,F - residual_F_lambda/polarBeta,params%temperature,params%timeinc, & + call Utilities_constitutiveResponse(F_lastInc,F - residual_F_lambda/polarBeta,params%timeinc, & residual_F,C_volAvg,C_minMaxAvg,P_av,ForwardData,params%rotation_BC) call MPI_Allreduce(MPI_IN_PLACE,terminallyIll,1,MPI_LOGICAL,MPI_LOR,PETSC_COMM_WORLD,ierr) ForwardData = .False. diff --git a/code/DAMASK_spectral_solverBasicPETSc.f90 b/code/DAMASK_spectral_solverBasicPETSc.f90 index 46945b0da..39f6493a6 100644 --- a/code/DAMASK_spectral_solverBasicPETSc.f90 +++ b/code/DAMASK_spectral_solverBasicPETSc.f90 @@ -87,7 +87,7 @@ contains !-------------------------------------------------------------------------------------------------- !> @brief allocates all neccessary fields and fills them with data, potentially from restart info !-------------------------------------------------------------------------------------------------- -subroutine basicPETSc_init(temperature) +subroutine basicPETSc_init use, intrinsic :: iso_fortran_env ! to get compiler_version and compiler_options (at least for gfortran >4.6 at the moment) use IO, only: & IO_intOut, & @@ -116,8 +116,6 @@ subroutine basicPETSc_init(temperature) math_invSym3333 implicit none - real(pReal), intent(inout) :: & - temperature real(pReal), dimension(:,:,:,:,:), allocatable :: P PetscScalar, dimension(:,:,:,:), pointer :: F PetscErrorCode :: ierr @@ -195,7 +193,6 @@ subroutine basicPETSc_init(temperature) call Utilities_updateIPcoords(F) call Utilities_constitutiveResponse(F_lastInc, F, & - temperature, & 0.0_pReal, & P, & C_volAvg,C_minMaxAvg, & ! global average of stiffness and (min+max)/2 @@ -229,7 +226,7 @@ end subroutine basicPETSc_init !> @brief solution for the Basic PETSC scheme with internal iterations !-------------------------------------------------------------------------------------------------- type(tSolutionState) function basicPETSc_solution( & - incInfoIn,guess,timeinc,timeinc_old,loadCaseTime,P_BC,F_BC,temperature_bc,rotation_BC) + incInfoIn,guess,timeinc,timeinc_old,loadCaseTime,P_BC,F_BC,rotation_BC) use numerics, only: & update_gamma, & itmax @@ -248,8 +245,7 @@ type(tSolutionState) function basicPETSc_solution( & real(pReal), intent(in) :: & timeinc, & !< increment in time for current solution timeinc_old, & !< increment in time of last increment - loadCaseTime, & !< remaining time of current load case - temperature_bc + loadCaseTime !< remaining time of current load case type(tBoundaryCondition), intent(in) :: & P_BC, & F_BC @@ -279,7 +275,6 @@ type(tSolutionState) function basicPETSc_solution( & params%rotation_BC = rotation_BC params%timeinc = timeinc params%timeincOld = timeinc_old - params%temperature = temperature_BC call SNESSolve(snes,PETSC_NULL_OBJECT,solution_vec,ierr); CHKERRQ(ierr) call SNESGetConvergedReason(snes,reason,ierr); CHKERRQ(ierr) @@ -368,7 +363,7 @@ subroutine BasicPETSC_formResidual(in,x_scal,f_scal,dummy,ierr) !-------------------------------------------------------------------------------------------------- ! evaluate constitutive response - call Utilities_constitutiveResponse(F_lastInc,x_scal,params%temperature,params%timeinc, & + call Utilities_constitutiveResponse(F_lastInc,x_scal,params%timeinc, & f_scal,C_volAvg,C_minmaxAvg,P_av,ForwardData,params%rotation_BC) call MPI_Allreduce(MPI_IN_PLACE,terminallyIll,1,MPI_LOGICAL,MPI_LOR,PETSC_COMM_WORLD,ierr) ForwardData = .false. diff --git a/code/DAMASK_spectral_solverPolarisation.f90 b/code/DAMASK_spectral_solverPolarisation.f90 index 874dea863..c07c51190 100644 --- a/code/DAMASK_spectral_solverPolarisation.f90 +++ b/code/DAMASK_spectral_solverPolarisation.f90 @@ -99,7 +99,7 @@ contains !> @brief allocates all neccessary fields and fills them with data, potentially from restart info !> @todo use sourced allocation, e.g. allocate(Fdot,source = F_lastInc) !-------------------------------------------------------------------------------------------------- -subroutine Polarisation_init(temperature) +subroutine Polarisation_init use, intrinsic :: iso_fortran_env ! to get compiler_version and compiler_options (at least for gfortran >4.6 at the moment) use IO, only: & IO_intOut, & @@ -127,8 +127,6 @@ subroutine Polarisation_init(temperature) math_invSym3333 implicit none - real(pReal), intent(inout) :: & - temperature real(pReal), dimension(:,:,:,:,:), allocatable :: P real(pReal), dimension(3,3) :: & temp33_Real = 0.0_pReal @@ -222,7 +220,7 @@ subroutine Polarisation_init(temperature) call Utilities_updateIPcoords(F) call Utilities_constitutiveResponse(F_lastInc,F,& - temperature,0.0_pReal,P,C_volAvg,C_minMaxAvg,temp33_Real,.false.,math_I3) + 0.0_pReal,P,C_volAvg,C_minMaxAvg,temp33_Real,.false.,math_I3) nullify(F) nullify(F_tau) call DMDAVecRestoreArrayF90(da,solution_vec,xx_psc,ierr); CHKERRQ(ierr) ! write data back to PETSc @@ -254,8 +252,7 @@ end subroutine Polarisation_init !> @brief solution for the Polarisation scheme with internal iterations !-------------------------------------------------------------------------------------------------- type(tSolutionState) function & - Polarisation_solution(incInfoIn,guess,timeinc,timeinc_old,loadCaseTime,P_BC,F_BC,temperature_bc, & - rotation_BC) + Polarisation_solution(incInfoIn,guess,timeinc,timeinc_old,loadCaseTime,P_BC,F_BC,rotation_BC) use numerics, only: & update_gamma use math, only: & @@ -275,8 +272,7 @@ type(tSolutionState) function & real(pReal), intent(in) :: & timeinc, & !< increment in time for current solution timeinc_old, & !< increment in time of last increment - loadCaseTime, & !< remaining time of current load case - temperature_bc + loadCaseTime !< remaining time of current load case logical, intent(in) :: & guess type(tBoundaryCondition), intent(in) :: & @@ -310,7 +306,6 @@ type(tSolutionState) function & params%rotation_BC = rotation_BC params%timeinc = timeinc params%timeincOld = timeinc_old - params%temperature = temperature_bc !-------------------------------------------------------------------------------------------------- ! solve BVP @@ -449,7 +444,7 @@ subroutine Polarisation_formResidual(in,x_scal,f_scal,dummy,ierr) !-------------------------------------------------------------------------------------------------- ! evaluate constitutive response P_avLastEval = P_av - call Utilities_constitutiveResponse(F_lastInc,F - residual_F_tau/polarBeta,params%temperature,params%timeinc, & + call Utilities_constitutiveResponse(F_lastInc,F - residual_F_tau/polarBeta,params%timeinc, & residual_F,C_volAvg,C_minMaxAvg,P_av,ForwardData,params%rotation_BC) call MPI_Allreduce(MPI_IN_PLACE,terminallyIll,1,MPI_LOGICAL,MPI_LOR,PETSC_COMM_WORLD,ierr) ForwardData = .False. diff --git a/code/DAMASK_spectral_utilities.f90 b/code/DAMASK_spectral_utilities.f90 index 2dfb2545b..851203d19 100644 --- a/code/DAMASK_spectral_utilities.f90 +++ b/code/DAMASK_spectral_utilities.f90 @@ -96,8 +96,7 @@ module DAMASK_spectral_utilities real(pReal), dimension (3,3) :: rotation = math_I3 !< rotation of BC type(tBoundaryCondition) :: P, & !< stress BC deformation !< deformation BC (Fdot or L) - real(pReal) :: time = 0.0_pReal, & !< length of increment - temperature = 300.0_pReal !< isothermal starting conditions + real(pReal) :: time = 0.0_pReal !< length of increment integer(pInt) :: incs = 0_pInt, & !< number of increments outputfrequency = 1_pInt, & !< frequency of result writes restartfrequency = 0_pInt, & !< frequency of restart writes @@ -110,7 +109,6 @@ module DAMASK_spectral_utilities real(pReal), dimension(3,3) :: P_BC, rotation_BC real(pReal) :: timeinc real(pReal) :: timeincOld - real(pReal) :: temperature real(pReal) :: density end type tSolutionParams @@ -1088,7 +1086,7 @@ end subroutine utilities_fourierVectorDivergence !-------------------------------------------------------------------------------------------------- !> @brief calculates constitutive response !-------------------------------------------------------------------------------------------------- -subroutine utilities_constitutiveResponse(F_lastInc,F,temperature,timeinc,& +subroutine utilities_constitutiveResponse(F_lastInc,F,timeinc,& P,C_volAvg,C_minmaxAvg,P_av,forwardData,rotation_BC) use debug, only: & debug_reset, & @@ -1115,7 +1113,6 @@ subroutine utilities_constitutiveResponse(F_lastInc,F,temperature,timeinc,& materialpoint_dPdF implicit none - real(pReal), intent(in) :: temperature !< temperature (no field) real(pReal), intent(in), dimension(3,3,gridLocal(1),gridLocal(2),gridLocal(3)) :: & F_lastInc, & !< target deformation gradient F !< previous deformation gradient @@ -1149,7 +1146,7 @@ subroutine utilities_constitutiveResponse(F_lastInc,F,temperature,timeinc,& endif call CPFEM_general(CPFEM_COLLECT,F_lastInc(1:3,1:3,1,1,1),F(1:3,1:3,1,1,1), & - temperature,timeinc,1_pInt,1_pInt) + timeinc,1_pInt,1_pInt) materialpoint_F = reshape(F,[3,3,1,product(gridLocal)]) call debug_reset() @@ -1174,7 +1171,7 @@ subroutine utilities_constitutiveResponse(F_lastInc,F,temperature,timeinc,& endif call CPFEM_general(calcMode,F_lastInc(1:3,1:3,1,1,1), F(1:3,1:3,1,1,1), & ! first call calculates everything - temperature,timeinc,1_pInt,1_pInt) + timeinc,1_pInt,1_pInt) max_dPdF = 0.0_pReal max_dPdF_norm = 0.0_pReal diff --git a/code/homogenization.f90 b/code/homogenization.f90 index 10bdd85fb..15781727d 100644 --- a/code/homogenization.f90 +++ b/code/homogenization.f90 @@ -72,7 +72,7 @@ contains !-------------------------------------------------------------------------------------------------- !> @brief module initialization !-------------------------------------------------------------------------------------------------- -subroutine homogenization_init(temperature_init) +subroutine homogenization_init #ifdef HDF use hdf5, only: & HID_T @@ -126,7 +126,6 @@ subroutine homogenization_init(temperature_init) worldrank implicit none - real(pReal), intent(in) :: temperature_init !< initial temperature integer(pInt), parameter :: FILEUNIT = 200_pInt integer(pInt) :: e,i,p integer(pInt), dimension(:,:), pointer :: thisSize diff --git a/code/spectral_thermal.f90 b/code/spectral_thermal.f90 index fbef1c29f..d9e06c834 100644 --- a/code/spectral_thermal.f90 +++ b/code/spectral_thermal.f90 @@ -76,7 +76,7 @@ contains !-------------------------------------------------------------------------------------------------- !> @brief allocates all neccessary fields and fills them with data, potentially from restart info !-------------------------------------------------------------------------------------------------- -subroutine spectral_thermal_init(temperature0) +subroutine spectral_thermal_init use, intrinsic :: iso_fortran_env ! to get compiler_version and compiler_options (at least for gfortran >4.6 at the moment) use IO, only: & IO_intOut, & @@ -91,13 +91,17 @@ subroutine spectral_thermal_init(temperature0) thermal_conduction_getConductivity33, & thermal_conduction_getMassDensity, & thermal_conduction_getSpecificHeat + use material, only: & + mappingHomogenization, & + temperature, & + thermalMapping implicit none - real(pReal), intent(inOut) :: temperature0 integer(pInt), dimension(:), allocatable :: localK integer(pInt) :: proc integer(pInt) :: i, j, k, cell DM :: thermal_grid + PetscScalar, pointer :: x_scal(:,:,:) PetscErrorCode :: ierr PetscObject :: dummy @@ -138,10 +142,20 @@ subroutine spectral_thermal_init(temperature0) xend = xstart + xend - 1 yend = ystart + yend - 1 zend = zstart + zend - 1 - call VecSet(solution,temperature0,ierr); CHKERRQ(ierr) - allocate(temperature_current(gridLocal(1),gridLocal(2),gridLocal(3)), source=temperature0) - allocate(temperature_lastInc(gridLocal(1),gridLocal(2),gridLocal(3)), source=temperature0) - allocate(temperature_stagInc(gridLocal(1),gridLocal(2),gridLocal(3)), source=temperature0) + allocate(temperature_current(gridLocal(1),gridLocal(2),gridLocal(3)), source=0.0_pReal) + allocate(temperature_lastInc(gridLocal(1),gridLocal(2),gridLocal(3)), source=0.0_pReal) + allocate(temperature_stagInc(gridLocal(1),gridLocal(2),gridLocal(3)), source=0.0_pReal) + cell = 0_pInt + do k = 1_pInt, gridLocal(3); do j = 1_pInt, gridLocal(2); do i = 1_pInt,gridLocal(1) + cell = cell + 1_pInt + temperature_current(i,j,k) = temperature(mappingHomogenization(2,1,cell))% & + p(thermalMapping(mappingHomogenization(2,1,cell))%p(1,cell)) + temperature_lastInc(i,j,k) = temperature_current(i,j,k) + temperature_stagInc(i,j,k) = temperature_current(i,j,k) + enddo; enddo; enddo + call DMDAVecGetArrayF90(thermal_grid,solution,x_scal,ierr); CHKERRQ(ierr) !< get the data out of PETSc to work with + x_scal(xstart:xend,ystart:yend,zstart:zend) = temperature_current + call DMDAVecRestoreArrayF90(thermal_grid,solution,x_scal,ierr); CHKERRQ(ierr) cell = 0_pInt D_ref = 0.0_pReal