From ea80e04ea8087ec30cb04e67c6cd4e9576b5bc97 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Tue, 26 Jun 2018 20:50:06 +0200 Subject: [PATCH] deallocating config, simplifying --- src/config.f90 | 7 +++---- src/homogenization.f90 | 13 ++++++++++--- src/material.f90 | 10 +++++++--- 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/src/config.f90 b/src/config.f90 index e97bfa3f8..dce4acc51 100644 --- a/src/config.f90 +++ b/src/config.f90 @@ -60,12 +60,12 @@ module config MATERIAL_partHomogenization = 'homogenization', & !< keyword for homogenization part MATERIAL_partCrystallite = 'crystallite', & !< keyword for crystallite part MATERIAL_partPhase = 'phase', & !< keyword for phase part - MATERIAL_partMicrostructure = 'microstructure', & !< keyword for microstructure part + MATERIAL_partMicrostructure = 'microstructure' !< keyword for microstructure part + character(len=*), parameter, private :: & MATERIAL_partTexture = 'texture' !< keyword for texture part ! ToDo: Remove, use size(phaseConfig) etc integer(pInt), public, protected :: & - material_Ntexture, & !< number of textures material_Nphase, & !< number of phases material_Nhomogenization, & !< number of homogenizations material_Nmicrostructure, & !< number of microstructures @@ -165,8 +165,7 @@ subroutine config_init() if (material_Ncrystallite < 1_pInt) call IO_error(160_pInt,ext_msg=material_partCrystallite) material_Nphase = size(phaseConfig) if (material_Nphase < 1_pInt) call IO_error(160_pInt,ext_msg=material_partPhase) - material_Ntexture = size(textureConfig) - if (material_Ntexture < 1_pInt) call IO_error(160_pInt,ext_msg=material_partTexture) + if (size(textureConfig) < 1_pInt) call IO_error(160_pInt,ext_msg=material_partTexture) end subroutine config_init diff --git a/src/homogenization.f90 b/src/homogenization.f90 index b50b6ff83..57dad3cbc 100644 --- a/src/homogenization.f90 +++ b/src/homogenization.f90 @@ -100,8 +100,13 @@ subroutine homogenization_init use crystallite, only: & crystallite_maxSizePostResults #endif + use config, only: & + config_deallocate, & + material_configFile, & + material_localFileExt, & + homogenizationConfig, & + homogenization_name use material - use config use homogenization_none use homogenization_isostrain use homogenization_RGC @@ -197,7 +202,7 @@ subroutine homogenization_init ! write description file for homogenization output mainProcess2: if (worldrank == 0) then call IO_write_jobFile(FILEUNIT,'outputHomogenization') - do p = 1,material_Nhomogenization + do p = 1,size(homogenizationConfig) if (any(material_homog == p)) then i = homogenization_typeInstance(p) ! which instance of this homogenization type valid = .true. ! assume valid @@ -370,6 +375,8 @@ subroutine homogenization_init close(FILEUNIT) endif mainProcess2 + call config_deallocate('material.config/homogenization') + !-------------------------------------------------------------------------------------------------- ! allocate and initialize global variables allocate(materialpoint_dPdF(3,3,3,3,mesh_maxNips,mesh_NcpElems), source=0.0_pReal) @@ -395,7 +402,7 @@ subroutine homogenization_init vacancyflux_maxSizePostResults = 0_pInt porosity_maxSizePostResults = 0_pInt hydrogenflux_maxSizePostResults = 0_pInt - do p = 1,material_Nhomogenization + do p = 1,size(homogenizationConfig) homogenization_maxSizePostResults = max(homogenization_maxSizePostResults,homogState (p)%sizePostResults) thermal_maxSizePostResults = max(thermal_maxSizePostResults, thermalState (p)%sizePostResults) damage_maxSizePostResults = max(damage_maxSizePostResults ,damageState (p)%sizePostResults) diff --git a/src/material.f90 b/src/material.f90 index 53b7f89ea..2aefb036a 100644 --- a/src/material.f90 +++ b/src/material.f90 @@ -360,7 +360,8 @@ subroutine material_init() homogenization_name, & microstructure_name, & phase_name, & - texture_name + texture_name, & + config_deallocate use mesh, only: & mesh_maxNips, & mesh_NcpElems, & @@ -468,6 +469,7 @@ subroutine material_init() endif debugOut call material_populateGrains + call config_deallocate('material.config/microstructure') allocate(phaseAt ( homogenization_maxNgrains,mesh_maxNips,mesh_NcpElems),source=0_pInt) allocate(phasememberAt ( homogenization_maxNgrains,mesh_maxNips,mesh_NcpElems),source=0_pInt) @@ -918,7 +920,8 @@ subroutine material_parseTexture IO_floatValue, & IO_stringValue use config, only: & - textureConfig + textureConfig, & + config_deallocate use math, only: & inRad, & math_sampleRandomOri, & @@ -1056,7 +1059,8 @@ subroutine material_parseTexture enddo endif enddo - + + call config_deallocate('material.config/texture') end subroutine material_parseTexture