diff --git a/src/config.f90 b/src/config.f90 index 9840001ed..207dedb7a 100644 --- a/src/config.f90 +++ b/src/config.f90 @@ -18,8 +18,9 @@ module config public :: & config_init, & - config_material_deallocate,& - config_numerics_deallocate + config_material_deallocate, & + config_numerics_deallocate, & + config_fetchReferences contains @@ -36,6 +37,54 @@ subroutine config_init() end subroutine config_init +!-------------------------------------------------------------------------------------------------- +!> @brief Deallocate config_material. +!-------------------------------------------------------------------------------------------------- +subroutine config_material_deallocate() + + print'(/,1x,a)', 'deallocating material configuration'; flush(IO_STDOUT) + deallocate(config_material) + +end subroutine config_material_deallocate + +!-------------------------------------------------------------------------------------------------- +!> @brief Deallocate config_numerics if present. +!-------------------------------------------------------------------------------------------------- +subroutine config_numerics_deallocate() + + if (.not. associated(config_numerics, emptyDict)) then + print'(/,1x,a)', 'deallocating numerics configuration'; flush(IO_STDOUT) + deallocate(config_numerics) + end if + +end subroutine config_numerics_deallocate + + +!-------------------------------------------------------------------------------------------------- +!> @brief Return string with references from dict. +!-------------------------------------------------------------------------------------------------- +function config_fetchReferences(config) result(references) + + type(tDict) :: config + character(len=:), allocatable :: references + + type(tList), pointer :: ref + integer :: r + + + ref => config%get_list('references',emptyList) + if (ref%length > 0) then + references = 'references:' + do r = 1, ref%length + references = references//IO_EOL//' '//IO_insertEOL(ref%get_asString(r)) + end do + else + references = '' + end if + +end function config_fetchReferences + + !-------------------------------------------------------------------------------------------------- !> @brief Read material.yaml. !-------------------------------------------------------------------------------------------------- @@ -93,27 +142,4 @@ subroutine parse_numerics() end subroutine parse_numerics - -!-------------------------------------------------------------------------------------------------- -!> @brief Deallocate config_material. -!-------------------------------------------------------------------------------------------------- -subroutine config_material_deallocate() - - print'(/,1x,a)', 'deallocating material configuration'; flush(IO_STDOUT) - deallocate(config_material) - -end subroutine config_material_deallocate - -!-------------------------------------------------------------------------------------------------- -!> @brief Deallocate config_numerics if present. -!-------------------------------------------------------------------------------------------------- -subroutine config_numerics_deallocate() - - if (.not. associated(config_numerics, emptyDict)) then - print'(/,1x,a)', 'deallocating numerics configuration'; flush(IO_STDOUT) - deallocate(config_numerics) - end if - -end subroutine config_numerics_deallocate - end module config diff --git a/src/material.f90 b/src/material.f90 index 9f3f1f6d0..2169c876a 100644 --- a/src/material.f90 +++ b/src/material.f90 @@ -49,8 +49,7 @@ module material material_v ! fraction public :: & - material_init, & - material_references + material_init contains @@ -79,31 +78,6 @@ subroutine material_init(restart) end subroutine material_init -!-------------------------------------------------------------------------------------------------- -!> @brief Return string with references from dict. -!-------------------------------------------------------------------------------------------------- -function material_references(config) result(references) - - type(tDict) :: config - character(len=:), allocatable :: references - - type(tList), pointer :: ref - integer :: r - - - ref => config%get_list('references',emptyList) - if (ref%length > 0) then - references = 'references:' - do r = 1, ref%length - references = references//IO_EOL//' '//IO_insertEOL(ref%get_asString(r)) - end do - else - references = '' - end if - -end function material_references - - !-------------------------------------------------------------------------------------------------- !> @brief Parse material.yaml to get the global structure. !-------------------------------------------------------------------------------------------------- diff --git a/src/phase.f90 b/src/phase.f90 index c34455f2a..98388fc74 100644 --- a/src/phase.f90 +++ b/src/phase.f90 @@ -394,7 +394,7 @@ subroutine phase_init do ph = 1,phases%length phase => phases%get_dict(ph) - print'(a,i0,a)', ' phase ',ph,' '//material_references(phase) + print'(a,i0,a)', ' phase ',ph,' '//config_fetchReferences(phase) phase_lattice(ph) = phase%get_asString('lattice') if (all(phase_lattice(ph) /= ['cF','cI','hP','tI'])) & call IO_error(130,ext_msg='phase_init: '//phase%get_asString('lattice')) diff --git a/src/phase_damage.f90 b/src/phase_damage.f90 index 7c5b31973..d2a25dcb3 100644 --- a/src/phase_damage.f90 +++ b/src/phase_damage.f90 @@ -103,7 +103,7 @@ module subroutine damage_init() phase => phases%get_dict(ph) source => phase%get_dict('damage',defaultVal=emptyDict) if (source%length > 0) then - print'(a,i0,a)', ' phase ',ph,' '//material_references(source) + print'(a,i0,a)', ' phase ',ph,' '//config_fetchReferences(source) damage_active = .true. param(ph)%mu = source%get_asFloat('mu') param(ph)%l_c = source%get_asFloat('l_c') diff --git a/src/phase_damage_anisobrittle.f90 b/src/phase_damage_anisobrittle.f90 index 7fe11a71e..9f09e37ac 100644 --- a/src/phase_damage_anisobrittle.f90 +++ b/src/phase_damage_anisobrittle.f90 @@ -62,7 +62,7 @@ module function anisobrittle_init() result(mySources) associate(prm => param(ph)) - print'(a,i0,a)', ' phase ',ph,' '//material_references(src) + print'(a,i0,a)', ' phase ',ph,' '//config_fetchReferences(src) N_cl = src%get_as1dInt('N_cl',defaultVal=emptyIntArray) prm%sum_N_cl = sum(abs(N_cl)) diff --git a/src/phase_damage_isobrittle.f90 b/src/phase_damage_isobrittle.f90 index 0b1641d38..cb496a44e 100644 --- a/src/phase_damage_isobrittle.f90 +++ b/src/phase_damage_isobrittle.f90 @@ -64,7 +64,7 @@ module function isobrittle_init() result(mySources) prm%W_crit = src%get_asFloat('G_crit')/src%get_asFloat('l_c') - print'(a,i0,a)', ' phase ',ph,' '//material_references(src) + print'(a,i0,a)', ' phase ',ph,' '//config_fetchReferences(src) #if defined (__GFORTRAN__) prm%output = output_as1dString(src) diff --git a/src/phase_mechanical_elastic.f90 b/src/phase_mechanical_elastic.f90 index 91cb7319d..3d54a9d7d 100644 --- a/src/phase_mechanical_elastic.f90 +++ b/src/phase_mechanical_elastic.f90 @@ -42,7 +42,7 @@ module subroutine elastic_init(phases) phase => phases%get_dict(ph) mech => phase%get_dict('mechanical') elastic => mech%get_dict('elastic') - print'(a,i0,a)', ' phase ',ph,' '//material_references(elastic) + print'(a,i0,a)', ' phase ',ph,' '//config_fetchReferences(elastic) if (elastic%get_asString('type') /= 'Hooke') call IO_error(200,ext_msg=elastic%get_asString('type')) associate(prm => param(ph)) diff --git a/src/phase_mechanical_plastic_dislotungsten.f90 b/src/phase_mechanical_plastic_dislotungsten.f90 index dedd876e2..4b3741e37 100644 --- a/src/phase_mechanical_plastic_dislotungsten.f90 +++ b/src/phase_mechanical_plastic_dislotungsten.f90 @@ -128,7 +128,7 @@ module function plastic_dislotungsten_init() result(myPlasticity) mech => phase%get_dict('mechanical') pl => mech%get_dict('plastic') - print'(a,i0,a)', ' phase ',ph,' '//material_references(pl) + print'(a,i0,a)', ' phase ',ph,' '//config_fetchReferences(pl) #if defined (__GFORTRAN__) prm%output = output_as1dString(pl) diff --git a/src/phase_mechanical_plastic_dislotwin.f90 b/src/phase_mechanical_plastic_dislotwin.f90 index b1c97a9e1..7375a402c 100644 --- a/src/phase_mechanical_plastic_dislotwin.f90 +++ b/src/phase_mechanical_plastic_dislotwin.f90 @@ -181,7 +181,7 @@ module function plastic_dislotwin_init() result(myPlasticity) mech => phase%get_dict('mechanical') pl => mech%get_dict('plastic') - print'(a,i0,a)', ' phase ',ph,' '//material_references(pl) + print'(a,i0,a)', ' phase ',ph,' '//config_fetchReferences(pl) #if defined (__GFORTRAN__) prm%output = output_as1dString(pl) diff --git a/src/phase_mechanical_plastic_isotropic.f90 b/src/phase_mechanical_plastic_isotropic.f90 index ae3fa2e80..443c9c9aa 100644 --- a/src/phase_mechanical_plastic_isotropic.f90 +++ b/src/phase_mechanical_plastic_isotropic.f90 @@ -86,7 +86,7 @@ module function plastic_isotropic_init() result(myPlasticity) mech => phase%get_dict('mechanical') pl => mech%get_dict('plastic') - print'(a,i0,a)', ' phase ',ph,' '//material_references(pl) + print'(a,i0,a)', ' phase ',ph,' '//config_fetchReferences(pl) #if defined (__GFORTRAN__) prm%output = output_as1dString(pl) diff --git a/src/phase_mechanical_plastic_kinehardening.f90 b/src/phase_mechanical_plastic_kinehardening.f90 index 8aa824a5f..16185130d 100644 --- a/src/phase_mechanical_plastic_kinehardening.f90 +++ b/src/phase_mechanical_plastic_kinehardening.f90 @@ -112,7 +112,7 @@ module function plastic_kinehardening_init() result(myPlasticity) mech => phase%get_dict('mechanical') pl => mech%get_dict('plastic') - print'(a,i0,a)', ' phase ',ph,' '//material_references(pl) + print'(a,i0,a)', ' phase ',ph,' '//config_fetchReferences(pl) #if defined (__GFORTRAN__) prm%output = output_as1dString(pl) diff --git a/src/phase_mechanical_plastic_nonlocal.f90 b/src/phase_mechanical_plastic_nonlocal.f90 index f157b2339..8bdf7daeb 100644 --- a/src/phase_mechanical_plastic_nonlocal.f90 +++ b/src/phase_mechanical_plastic_nonlocal.f90 @@ -234,7 +234,7 @@ module function plastic_nonlocal_init() result(myPlasticity) mech => phase%get_dict('mechanical') pl => mech%get_dict('plastic') - print'(a,i0,a)', ' phase ',ph,' '//material_references(pl) + print'(a,i0,a)', ' phase ',ph,' '//config_fetchReferences(pl) #if defined (__GFORTRAN__) prm%output = output_as1dString(pl) diff --git a/src/phase_mechanical_plastic_phenopowerlaw.f90 b/src/phase_mechanical_plastic_phenopowerlaw.f90 index 0f8b9a299..9d6f78213 100644 --- a/src/phase_mechanical_plastic_phenopowerlaw.f90 +++ b/src/phase_mechanical_plastic_phenopowerlaw.f90 @@ -122,7 +122,7 @@ module function plastic_phenopowerlaw_init() result(myPlasticity) mech => phase%get_dict('mechanical') pl => mech%get_dict('plastic') - print'(a,i0,a)', ' phase ',ph,' '//material_references(pl) + print'(a,i0,a)', ' phase ',ph,' '//config_fetchReferences(pl) #if defined (__GFORTRAN__) prm%output = output_as1dString(pl) diff --git a/src/phase_thermal.f90 b/src/phase_thermal.f90 index dc80aa423..2dc32560e 100644 --- a/src/phase_thermal.f90 +++ b/src/phase_thermal.f90 @@ -107,7 +107,7 @@ module subroutine thermal_init(phases) ! ToDo: temperature dependency of K and C_p if (thermal%length > 0) then - print'(a,i0,a)', ' phase ',ph,' '//material_references(thermal) + print'(a,i0,a)', ' phase ',ph,' '//config_fetchReferences(thermal) param(ph)%C_p = thermal%get_asFloat('C_p') param(ph)%K(1,1) = thermal%get_asFloat('K_11') if (any(phase_lattice(ph) == ['hP','tI'])) param(ph)%K(3,3) = thermal%get_asFloat('K_33') diff --git a/src/phase_thermal_dissipation.f90 b/src/phase_thermal_dissipation.f90 index ffb48f80c..9c9015922 100644 --- a/src/phase_thermal_dissipation.f90 +++ b/src/phase_thermal_dissipation.f90 @@ -56,7 +56,7 @@ module function dissipation_init(source_length) result(mySources) if (mySources(so,ph)) then associate(prm => param(ph)) src => sources%get_dict(so) - print'(a,i0,a,i0,a)', ' phase ',ph,' source ',so,' '//material_references(src) + print'(a,i0,a,i0,a)', ' phase ',ph,' source ',so,' '//config_fetchReferences(src) prm%kappa = src%get_asFloat('kappa') Nmembers = count(material_ID_phase == ph) diff --git a/src/phase_thermal_externalheat.f90 b/src/phase_thermal_externalheat.f90 index 421117f9e..4dad5248e 100644 --- a/src/phase_thermal_externalheat.f90 +++ b/src/phase_thermal_externalheat.f90 @@ -60,7 +60,7 @@ module function externalheat_init(source_length) result(mySources) source_thermal_externalheat_offset(ph) = so associate(prm => param(ph)) src => sources%get_dict(so) - print'(a,i0,a,i0,a)', ' phase ',ph,' source ',so,' '//material_references(src) + print'(a,i0,a,i0,a)', ' phase ',ph,' source ',so,' '//config_fetchReferences(src) prm%f = table(src,'t','f')