From b44a862a8a5acfa2704f3e5116445fb6584cecfc Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sat, 19 Feb 2022 14:19:11 +0100 Subject: [PATCH] data structures to output mechanical results (homogenization) --- src/homogenization.f90 | 2 +- src/homogenization_mechanical.f90 | 33 +++++++++++++++++++++---------- src/phase_mechanical.f90 | 25 ++++++++++++----------- 3 files changed, 37 insertions(+), 23 deletions(-) diff --git a/src/homogenization.f90 b/src/homogenization.f90 index c9212e764..c259825c3 100644 --- a/src/homogenization.f90 +++ b/src/homogenization.f90 @@ -32,7 +32,7 @@ module homogenization HOMOGENIZATION_RGC_ID end enum - type(tState), allocatable, dimension(:), public :: & + type(tState), allocatable, dimension(:), public :: & homogState, & damageState_h diff --git a/src/homogenization_mechanical.f90 b/src/homogenization_mechanical.f90 index 55ca8c920..6a42e6a87 100644 --- a/src/homogenization_mechanical.f90 +++ b/src/homogenization_mechanical.f90 @@ -50,6 +50,12 @@ submodule(homogenization) mechanical end interface + type :: tOutput !< requested output (per phase) + character(len=pStringLen), allocatable, dimension(:) :: & + label + end type tOutput + type(tOutput), allocatable, dimension(:) :: output_mechanical + integer(kind(HOMOGENIZATION_undefined_ID)), dimension(:), allocatable :: & homogenization_type !< type of each homogenization @@ -206,26 +212,33 @@ subroutine parseMechanical() class(tNode), pointer :: & material_homogenization, & homog, & - homogMech + mechanical + + integer :: ho - integer :: h material_homogenization => config_material%get('homogenization') allocate(homogenization_type(size(material_name_homogenization)), source=HOMOGENIZATION_undefined_ID) + allocate(output_mechanical(size(material_name_homogenization))) - do h=1, size(material_name_homogenization) - homog => material_homogenization%get(h) - homogMech => homog%get('mechanical') - select case (homogMech%get_asString('type')) + do ho=1, size(material_name_homogenization) + homog => material_homogenization%get(ho) + mechanical => homog%get('mechanical') +#if defined(__GFORTRAN__) + output_mechanical(ho)%label = output_as1dString(mechanical) +#else + output_mechanical(ho)%label = mechanical%get_as1dString('output',defaultVal=emptyStringArray) +#endif + select case (mechanical%get_asString('type')) case('pass') - homogenization_type(h) = HOMOGENIZATION_NONE_ID + homogenization_type(ho) = HOMOGENIZATION_NONE_ID case('isostrain') - homogenization_type(h) = HOMOGENIZATION_ISOSTRAIN_ID + homogenization_type(ho) = HOMOGENIZATION_ISOSTRAIN_ID case('RGC') - homogenization_type(h) = HOMOGENIZATION_RGC_ID + homogenization_type(ho) = HOMOGENIZATION_RGC_ID case default - call IO_error(500,ext_msg=homogMech%get_asString('type')) + call IO_error(500,ext_msg=mechanical%get_asString('type')) end select end do diff --git a/src/phase_mechanical.f90 b/src/phase_mechanical.f90 index 05866a3e1..37a183b27 100644 --- a/src/phase_mechanical.f90 +++ b/src/phase_mechanical.f90 @@ -180,11 +180,12 @@ submodule(phase) mechanical end function elastic_nu end interface - type :: tOutput !< new requested output (per phase) + + type :: tOutput !< requested output (per phase) character(len=pStringLen), allocatable, dimension(:) :: & label end type tOutput - type(tOutput), allocatable, dimension(:) :: output_constituent + type(tOutput), allocatable, dimension(:) :: output_mechanical procedure(integrateStateFPI), pointer :: integrateState @@ -216,7 +217,7 @@ module subroutine mechanical_init(phases) print'(/,1x,a)', '<<<+- phase:mechanical init -+>>>' !------------------------------------------------------------------------------------------------- - allocate(output_constituent(phases%length)) + allocate(output_mechanical(phases%length)) allocate(phase_mechanical_Fe(phases%length)) allocate(phase_mechanical_Fi(phases%length)) @@ -251,12 +252,12 @@ module subroutine mechanical_init(phases) allocate(phase_mechanical_P(ph)%data(3,3,Nmembers),source=0.0_pReal) allocate(phase_mechanical_S0(ph)%data(3,3,Nmembers),source=0.0_pReal) - phase => phases%get(ph) - mech => phase%get('mechanical') + phase => phases%get(ph) + mech => phase%get('mechanical') #if defined(__GFORTRAN__) - output_constituent(ph)%label = output_as1dString(mech) + output_mechanical(ph)%label = output_as1dString(mech) #else - output_constituent(ph)%label = mech%get_as1dString('output',defaultVal=emptyStringArray) + output_mechanical(ph)%label = mech%get_as1dString('output',defaultVal=emptyStringArray) #endif enddo @@ -891,9 +892,9 @@ subroutine crystallite_results(group,ph) call results_closeGroup(results_addGroup(group//'/mechanical')) - do ou = 1, size(output_constituent(ph)%label) + do ou = 1, size(output_mechanical(ph)%label) - select case (output_constituent(ph)%label(ou)) + select case (output_mechanical(ph)%label(ou)) case('F') call results_writeDataset(phase_mechanical_F(ph)%data,group//'/mechanical/','F',& 'deformation gradient','1') @@ -919,11 +920,11 @@ subroutine crystallite_results(group,ph) call results_writeDataset(phase_mechanical_S(ph)%data,group//'/mechanical/','S', & 'second Piola-Kirchhoff stress','Pa') case('O') - call results_writeDataset(to_quaternion(phase_O(ph)%data),group//'/mechanical',output_constituent(ph)%label(ou),& + call results_writeDataset(to_quaternion(phase_O(ph)%data),group//'/mechanical',output_mechanical(ph)%label(ou),& 'crystal orientation as quaternion','q_0 (q_1 q_2 q_3)') - call results_addAttribute('lattice',phase_lattice(ph),group//'/mechanical/'//output_constituent(ph)%label(ou)) + call results_addAttribute('lattice',phase_lattice(ph),group//'/mechanical/'//output_mechanical(ph)%label(ou)) if (any(phase_lattice(ph) == ['hP', 'tI'])) & - call results_addAttribute('c/a',phase_cOverA(ph),group//'/mechanical/'//output_constituent(ph)%label(ou)) + call results_addAttribute('c/a',phase_cOverA(ph),group//'/mechanical/'//output_mechanical(ph)%label(ou)) end select enddo