diff --git a/src/CPFEM2.f90 b/src/CPFEM2.f90 index c6f08cbf6..45e423fe3 100644 --- a/src/CPFEM2.f90 +++ b/src/CPFEM2.f90 @@ -300,6 +300,8 @@ subroutine CPFEM_results(inc,time) use HDF5_utilities use constitutive, only: & constitutive_results + use crystallite, only: & + crystallite_results implicit none integer(pInt), intent(in) :: inc @@ -307,7 +309,8 @@ subroutine CPFEM_results(inc,time) call results_openJobFile call results_addIncrement(inc,time) - call constitutive_results() + call constitutive_results + call crystallite_results call results_removeLink('current') ! ToDo: put this into closeJobFile call results_closeJobFile diff --git a/src/constitutive.f90 b/src/constitutive.f90 index 3c837c6ed..ea349e7ac 100644 --- a/src/constitutive.f90 +++ b/src/constitutive.f90 @@ -50,8 +50,7 @@ subroutine constitutive_init IO_write_jobFile use config, only: & material_Nphase, & - phase_name, & - config_deallocate + phase_name use material, only: & material_phase, & phase_plasticity, & @@ -149,8 +148,6 @@ subroutine constitutive_init if (any(phase_kinematics == KINEMATICS_slipplane_opening_ID)) call kinematics_slipplane_opening_init if (any(phase_kinematics == KINEMATICS_thermal_expansion_ID)) call kinematics_thermal_expansion_init - call config_deallocate('material.config/phase') - write(6,'(/,a)') ' <<<+- constitutive init -+>>>' mainProcess: if (worldrank == 0) then @@ -1077,7 +1074,7 @@ end function constitutive_postResults !-------------------------------------------------------------------------------------------------- !> @brief writes constitutive results to HDF5 output file !-------------------------------------------------------------------------------------------------- -subroutine constitutive_results() +subroutine constitutive_results use material, only: & PLASTICITY_ISOTROPIC_ID, & PLASTICITY_PHENOPOWERLAW_ID, & diff --git a/src/crystallite.f90 b/src/crystallite.f90 index b234d133d..b68cdc86e 100644 --- a/src/crystallite.f90 +++ b/src/crystallite.f90 @@ -10,7 +10,8 @@ module crystallite use prec, only: & - pReal + pReal, & + pStringLen use rotations, only: & rotation use FEsolving, only: & @@ -103,6 +104,8 @@ module crystallite end enum integer(kind(undefined_ID)),dimension(:,:), allocatable, private :: & crystallite_outputID !< ID of each post result output + character(len=pStringLen), dimension(:), allocatable, private :: & + constituent_output procedure(), pointer :: integrateState public :: & @@ -111,7 +114,8 @@ module crystallite crystallite_stressTangent, & crystallite_orientations, & crystallite_push33ToRef, & - crystallite_postResults + crystallite_postResults, & + crystallite_results private :: & integrateStress, & integrateState, & @@ -156,6 +160,7 @@ subroutine crystallite_init use config, only: & config_deallocate, & config_crystallite, & + config_phase, & crystallite_name use constitutive, only: & constitutive_initialFi, & @@ -296,6 +301,21 @@ subroutine crystallite_init end select outputName enddo enddo + + allocate(constituent_output(size(config_phase))) + do c = 1, size(config_phase) +#if defined(__GFORTRAN__) + str = ['GfortranBug86277'] + str = config_crystallite(c)%getStrings('(output)',defaultVal=str) + if (str(1) == 'GfortranBug86277') str = [character(len=65536)::] +#else + str = config_crystallite(c)%getStrings('(output)',defaultVal=[character(len=65536)::]) +#endif + constituent_output(c) = '+' + do o = 1, size(str) + constituent_output(c) = trim(constituent_output(c))//trim(str(o))//'+' + enddo + enddo do r = 1,size(config_crystallite) @@ -340,6 +360,7 @@ subroutine crystallite_init close(FILEUNIT) endif + call config_deallocate('material.config/phase') call config_deallocate('material.config/crystallite') !-------------------------------------------------------------------------------------------------- @@ -1053,6 +1074,55 @@ function crystallite_postResults(ipc, ip, el) end function crystallite_postResults +!-------------------------------------------------------------------------------------------------- +!> @brief writes constitutive results to HDF5 output file +!-------------------------------------------------------------------------------------------------- +subroutine crystallite_results +#if defined(PETSc) || defined(DAMASK_HDF5) + use results + use HDF5_utilities + use config, only: & + config_name_phase => phase_name ! anticipate logical name + + use material, only: & + material_phaseAt, & + phase_plasticityInstance, & + material_phase_plasticity_type => phase_plasticity + + implicit none + integer :: p + real(pReal), allocatable, dimension(:,:,:) :: packe + character(len=256) :: group + character(len=16) :: i + + call HDF5_closeGroup(results_addGroup('current/constituent')) + + do p=1,size(config_name_phase) + write(i,('(i2.2)')) p ! allow 99 groups + group = trim('current/constituent')//'/'//trim(i)//'_'//trim(config_name_phase(p)) + if (index(constituent_output(p),'+f+') /= 0) then + print*, 'f' + endif + if (index(constituent_output(p),'+p+') /= 0) then + print*, 'p' + endif + enddo + + contains + + function packed(res) + + real(pReal), dimension(:,:,:,:,:), intent(in) :: res + real(pReal), allocatable, dimension(:,:,:) :: packed + + + end function packed +#endif + + +end subroutine crystallite_results + + !-------------------------------------------------------------------------------------------------- !> @brief calculation of stress (P) with time integration based on a residuum in Lp and !> intermediate acceleration of the Newton-Raphson correction