Restructuring for material.yaml

This commit is contained in:
Sharan Roongta 2020-08-15 16:02:10 +02:00
parent 95092f3c5f
commit 7754a1ea56
63 changed files with 2291 additions and 2166 deletions

@ -1 +1 @@
Subproject commit a52584687a93b9f007cf019861fce68eb31451ab Subproject commit a16d1e45a2ed925e12244b0879b9d7e5a58d973b

View File

@ -1,126 +0,0 @@
#-------------------#
<homogenization>
#-------------------#
[SX]
mech none
#-------------------#
<phase>
#-------------------#
[Aluminum_phenopowerlaw]
elasticity hooke
plasticity phenopowerlaw
(output) resistance_slip
(output) orientation # quaternion
(output) F # deformation gradient tensor
(output) Fe # elastic deformation gradient tensor
(output) Fp # plastic deformation gradient tensor
(output) P # first Piola-Kichhoff stress tensor
(output) Lp # plastic velocity gradient tensor
lattice_structure fcc
Nslip 12 # per family
c11 106.75e9
c12 60.41e9
c44 28.34e9
gdot0_slip 0.001
n_slip 20
tau0_slip 31e6 # per family
tausat_slip 63e6 # per family
a_slip 2.25
h0_slipslip 75e6
interaction_slipslip 1 1 1.4 1.4 1.4 1.4
#-------------------#
<microstructure>
#-------------------#
[Grain01]
(constituent) phase 1 texture 01 fraction 1.0
[Grain02]
(constituent) phase 1 texture 02 fraction 1.0
[Grain03]
(constituent) phase 1 texture 03 fraction 1.0
[Grain04]
(constituent) phase 1 texture 04 fraction 1.0
[Grain05]
(constituent) phase 1 texture 05 fraction 1.0
[Grain06]
(constituent) phase 1 texture 06 fraction 1.0
[Grain07]
(constituent) phase 1 texture 07 fraction 1.0
[Grain08]
(constituent) phase 1 texture 08 fraction 1.0
[Grain09]
(constituent) phase 1 texture 09 fraction 1.0
[Grain10]
(constituent) phase 1 texture 10 fraction 1.0
[Grain11]
(constituent) phase 1 texture 11 fraction 1.0
[Grain12]
(constituent) phase 1 texture 12 fraction 1.0
[Grain13]
(constituent) phase 1 texture 13 fraction 1.0
[Grain14]
(constituent) phase 1 texture 14 fraction 1.0
[Grain15]
(constituent) phase 1 texture 15 fraction 1.0
[Grain16]
(constituent) phase 1 texture 16 fraction 1.0
[Grain17]
(constituent) phase 1 texture 17 fraction 1.0
[Grain18]
(constituent) phase 1 texture 18 fraction 1.0
[Grain19]
(constituent) phase 1 texture 19 fraction 1.0
[Grain20]
(constituent) phase 1 texture 20 fraction 1.0
#-------------------#
<texture>
#-------------------#
[Grain01]
(gauss) phi1 0.0 Phi 0.0 phi2 0.0
[Grain02]
(gauss) phi1 257.468172 Phi 53.250534 phi2 157.331503
[Grain03]
(gauss) phi1 216.994815 Phi 94.418518 phi2 251.147231
[Grain04]
(gauss) phi1 196.157946 Phi 55.870978 phi2 21.68117
[Grain05]
(gauss) phi1 152.515728 Phi 139.769395 phi2 240.036018
[Grain06]
(gauss) phi1 232.521881 Phi 73.749222 phi2 241.429633
[Grain07]
(gauss) phi1 157.531396 Phi 135.503513 phi2 75.737722
[Grain08]
(gauss) phi1 321.03828 Phi 27.209843 phi2 46.413467
[Grain09]
(gauss) phi1 346.918594 Phi 87.495569 phi2 113.554206
[Grain10]
(gauss) phi1 138.038947 Phi 99.827132 phi2 130.935878
[Grain11]
(gauss) phi1 285.021014 Phi 118.092004 phi2 205.270837
[Grain12]
(gauss) phi1 190.402171 Phi 56.738068 phi2 157.896545
[Grain13]
(gauss) phi1 204.496042 Phi 95.031265 phi2 355.814582
[Grain14]
(gauss) phi1 333.21479 Phi 82.133355 phi2 36.736132
[Grain15]
(gauss) phi1 25.572981 Phi 164.242648 phi2 75.195632
[Grain16]
(gauss) phi1 31.366548 Phi 76.392403 phi2 58.071426
[Grain17]
(gauss) phi1 7.278623 Phi 77.044663 phi2 235.118997
[Grain18]
(gauss) phi1 299.743144 Phi 76.475096 phi2 91.184977
[Grain19]
(gauss) phi1 280.13643 Phi 27.439718 phi2 167.871878
[Grain20]
(gauss) phi1 313.204373 Phi 68.676053 phi2 87.993213

View File

@ -0,0 +1,123 @@
homogenization:
SX:
mech: {type: none}
microstructure:
- constituents:
- fraction: 1.0
orientation: [1.0, 0.0, 0.0, 0.0]
phase: Aluminum
homogenization: SX
- constituents:
- fraction: 1.0
orientation: [0.7936696712125002, -0.28765777461664166, -0.3436487135089419, 0.4113964260949434]
phase: Aluminum
homogenization: SX
- constituents:
- fraction: 1.0
orientation: [0.3986143167493579, -0.7014883552495493, 0.2154871765709027, 0.5500781677772945]
phase: Aluminum
homogenization: SX
- constituents:
- fraction: 1.0
orientation: [0.28645844315788244, -0.022571491243423537, -0.467933059311115, -0.8357456192708106]
phase: Aluminum
homogenization: SX
- constituents:
- fraction: 1.0
orientation: [0.33012772942625784, -0.6781865350268957, 0.6494525351030648, 0.09638521992649676]
phase: Aluminum
homogenization: SX
- constituents:
- fraction: 1.0
orientation: [0.43596817439583935, -0.5982537129781701, 0.046599032277502436, 0.6707106499919265]
phase: Aluminum
homogenization: SX
- constituents:
- fraction: 1.0
orientation: [0.169734823419553, -0.699615227367322, -0.6059581215838098, -0.33844257746495854]
phase: Aluminum
homogenization: SX
- constituents:
- fraction: 1.0
orientation: [0.9698864809294915, 0.1729052643205874, -0.15948307917616958, 0.06315956884687175]
phase: Aluminum
homogenization: SX
- constituents:
- fraction: 1.0
orientation: [0.46205660912967883, 0.3105054068891252, -0.617849551030653, 0.555294529545738]
phase: Aluminum
homogenization: SX
- constituents:
- fraction: 1.0
orientation: [0.4512443497461787, -0.7636045534540555, -0.04739348426715133, -0.45939142396805815]
phase: Aluminum
homogenization: SX
- constituents:
- fraction: 1.0
orientation: [0.2161856212656443, -0.6581450184826598, -0.5498086209601588, 0.4667112513346289]
phase: Aluminum
homogenization: SX
- constituents:
- fraction: 1.0
orientation: [0.8753220715350803, -0.4561599367657419, -0.13298279533852678, -0.08969369719975541]
phase: Aluminum
homogenization: SX
- constituents:
- fraction: 1.0
orientation: [0.11908260752431069, 0.18266024809834172, -0.7144822594012615, -0.664807992845101]
phase: Aluminum
homogenization: SX
- constituents:
- fraction: 1.0
orientation: [0.751104669484278, 0.5585633382623958, -0.34579336397009175, 0.06538900566860861]
phase: Aluminum
homogenization: SX
- constituents:
- fraction: 1.0
orientation: [0.08740438971703973, 0.8991264096610437, -0.4156704205935976, 0.10559485570696363]
phase: Aluminum
homogenization: SX
- constituents:
- fraction: 1.0
orientation: [0.5584325870096193, 0.6016408353068798, -0.14280340445801173, 0.5529814994483859]
phase: Aluminum
homogenization: SX
- constituents:
- fraction: 1.0
orientation: [0.4052725440888093, 0.25253073423599154, 0.5693263597910454, -0.669215876471182]
phase: Aluminum
homogenization: SX
- constituents:
- fraction: 1.0
orientation: [0.7570164606888676, 0.15265448024694664, -0.5998021466848317, 0.20942796551297105]
phase: Aluminum
homogenization: SX
- constituents:
- fraction: 1.0
orientation: [0.6987659297138081, -0.132172211261028, -0.19693254724422338, 0.6748883269678543]
phase: Aluminum
homogenization: SX
- constituents:
- fraction: 1.0
orientation: [0.7729330445886478, 0.21682179052722322, -0.5207379472917645, 0.2905078484066341]
phase: Aluminum
homogenization: SX
phase:
Aluminum:
elasticity: {C_11: 106.75e9, C_12: 60.41e9, C_44: 28.34e9, type: hooke}
generic:
output: [F, P, Fe, Fp, Lp]
lattice: fcc
plasticity:
N_sl: [12]
a_sl: 2.25
atol_xi: 1.0
dot_gamma_0_sl: 0.001
h_0_sl_sl: 75e6
h_sl_sl: [1, 1, 1.4, 1.4, 1.4, 1.4]
n_sl: 20
output: [xi_sl]
xi_0_sl: [31e6]
xi_inf_sl: [63e6]
type: phenopowerlaw

View File

@ -5,7 +5,6 @@
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
module CPFEM module CPFEM
use prec use prec
use debug
use FEsolving use FEsolving
use math use math
use rotations use rotations
@ -19,7 +18,6 @@ module CPFEM
use IO use IO
use discretization use discretization
use DAMASK_interface use DAMASK_interface
use numerics
use HDF5_utilities use HDF5_utilities
use results use results
use lattice use lattice
@ -79,8 +77,6 @@ subroutine CPFEM_initAll
call DAMASK_interface_init call DAMASK_interface_init
call prec_init call prec_init
call IO_init call IO_init
call numerics_init
call debug_init
call config_init call config_init
call math_init call math_init
call rotations_init call rotations_init
@ -95,6 +91,7 @@ subroutine CPFEM_initAll
call crystallite_init call crystallite_init
call homogenization_init call homogenization_init
call CPFEM_init call CPFEM_init
call config_deallocate
end subroutine CPFEM_initAll end subroutine CPFEM_initAll

View File

@ -5,8 +5,6 @@
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
module CPFEM2 module CPFEM2
use prec use prec
use numerics
use debug
use config use config
use FEsolving use FEsolving
use math use math
@ -47,8 +45,6 @@ subroutine CPFEM_initAll
#ifdef Mesh #ifdef Mesh
call FEM_quadrature_init call FEM_quadrature_init
#endif #endif
call numerics_init
call debug_init
call config_init call config_init
call math_init call math_init
call rotations_init call rotations_init
@ -67,6 +63,7 @@ subroutine CPFEM_initAll
call crystallite_init call crystallite_init
call homogenization_init call homogenization_init
call CPFEM_init call CPFEM_init
call config_deallocate
end subroutine CPFEM_initAll end subroutine CPFEM_initAll

View File

@ -175,10 +175,9 @@ subroutine hypela2(d,g,e,de,s,t,dt,ngens,m,nn,kcus,matus,ndi,nshear,disp, &
jtype,lclass,ifr,ifu) jtype,lclass,ifr,ifu)
use prec use prec
use DAMASK_interface use DAMASK_interface
use numerics use config
use YAML_types use YAML_types
use FEsolving use FEsolving
use debug
use discretization_marc use discretization_marc
use homogenization use homogenization
use CPFEM use CPFEM

View File

@ -13,7 +13,7 @@ module HDF5_utilities
use prec use prec
use IO use IO
use rotations use rotations
use numerics use config
implicit none implicit none
public public

View File

@ -392,9 +392,9 @@ logical function IO_stringAsBool(string)
character(len=*), intent(in) :: string !< string for conversion to int value character(len=*), intent(in) :: string !< string for conversion to int value
if (trim(adjustl(string)) == 'True') then if (trim(adjustl(string)) == 'True' .or. trim(adjustl(string)) == 'true') then
IO_stringAsBool = .true. IO_stringAsBool = .true.
elseif (trim(adjustl(string)) == 'False') then elseif (trim(adjustl(string)) == 'False' .or. trim(adjustl(string)) == 'false') then
IO_stringAsBool = .false. IO_stringAsBool = .false.
else else
IO_stringAsBool = .false. IO_stringAsBool = .false.
@ -568,8 +568,6 @@ subroutine IO_error(error_ID,el,ip,g,instance,ext_msg)
msg = 'Incorrect indent/Null value not allowed' msg = 'Incorrect indent/Null value not allowed'
case (702) case (702)
msg = 'Invalid use of flow yaml' msg = 'Invalid use of flow yaml'
case (703)
msg = 'Space expected after a list indicator - '
case (704) case (704)
msg = 'Space expected after a colon for <key>: <value> pair' msg = 'Space expected after a colon for <key>: <value> pair'
case (705) case (705)
@ -751,9 +749,9 @@ subroutine selfTest
if(-3112019 /= IO_stringAsInt('-3112019')) call IO_error(0,ext_msg='IO_stringAsInt') if(-3112019 /= IO_stringAsInt('-3112019')) call IO_error(0,ext_msg='IO_stringAsInt')
if(3112019 /= IO_stringAsInt('+3112019 ')) call IO_error(0,ext_msg='IO_stringAsInt') if(3112019 /= IO_stringAsInt('+3112019 ')) call IO_error(0,ext_msg='IO_stringAsInt')
if(.not. IO_stringAsBool(' True')) call IO_error(0,ext_msg='IO_stringAsBool') if(.not. IO_stringAsBool(' true')) call IO_error(0,ext_msg='IO_stringAsBool')
if(.not. IO_stringAsBool(' True ')) call IO_error(0,ext_msg='IO_stringAsBool') if(.not. IO_stringAsBool(' True ')) call IO_error(0,ext_msg='IO_stringAsBool')
if( IO_stringAsBool(' False')) call IO_error(0,ext_msg='IO_stringAsBool') if( IO_stringAsBool(' false')) call IO_error(0,ext_msg='IO_stringAsBool')
if( IO_stringAsBool('False')) call IO_error(0,ext_msg='IO_stringAsBool') if( IO_stringAsBool('False')) call IO_error(0,ext_msg='IO_stringAsBool')
if(any([1,1,1] /= IO_stringPos('a'))) call IO_error(0,ext_msg='IO_stringPos') if(any([1,1,1] /= IO_stringPos('a'))) call IO_error(0,ext_msg='IO_stringPos')

View File

@ -4,19 +4,18 @@
!> @brief Parser for YAML files !> @brief Parser for YAML files
!> @details module converts a YAML input file to an equivalent YAML flow style which is then parsed. !> @details module converts a YAML input file to an equivalent YAML flow style which is then parsed.
!---------------------------------------------------------------------------------------------------- !----------------------------------------------------------------------------------------------------
module YAML_parse module YAML_parse
use prec use prec
use IO use IO
use YAML_types use YAML_types
implicit none implicit none
private private
public :: YAML_init public :: &
public :: parse_flow,to_flow YAML_init, &
parse_flow, &
to_flow
contains contains
@ -34,19 +33,22 @@ end subroutine YAML_init
!> @brief reads the flow style string and stores it in the form of dictionaries, lists and scalars. !> @brief reads the flow style string and stores it in the form of dictionaries, lists and scalars.
!> @details A node type pointer can either point to a dictionary, list or scalar type entities. !> @details A node type pointer can either point to a dictionary, list or scalar type entities.
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
recursive function parse_flow(flow_string) result(node) recursive function parse_flow(YAML_flow) result(node)
character(len=*), intent(inout) :: flow_string !< YAML file in flow style character(len=*), intent(in) :: YAML_flow !< YAML file in flow style
class (tNode), pointer :: node class (tNode), pointer :: node
class (tNode), pointer :: myVal class (tNode), pointer :: &
character(len=pStringLen) :: key myVal
character(len=:), allocatable :: &
integer :: e, & ! end position of dictionary or list flow_string, &
s, & ! start position of dictionary or list key
d ! position of key: value separator (':') integer :: &
e, & ! end position of dictionary or list
flow_string = trim(adjustl(flow_string(:))) s, & ! start position of dictionary or list
d ! position of key: value separator (':')
flow_string = trim(adjustl(YAML_flow(:)))
if (len_trim(flow_string) == 0) then if (len_trim(flow_string) == 0) then
node => emptyDict node => emptyDict
return return
@ -166,7 +168,12 @@ logical function isListItem(line)
character(len=*), intent(in) :: line character(len=*), intent(in) :: line
isListItem = index(adjustl(line),'-') == 1 isListItem = .false.
if(len_trim(adjustl(line))> 2 .and. index(trim(adjustl(line)), '-') == 1) then
isListItem = scan(trim(adjustl(line)),' ') == 2
else
isListItem = trim(adjustl(line)) == '-'
endif
end function isListItem end function isListItem
@ -337,7 +344,7 @@ recursive subroutine lst(blck,flow,s_blck,s_flow,offset)
integer, intent(inout) :: s_blck, & !< start position in blck integer, intent(inout) :: s_blck, & !< start position in blck
s_flow, & !< start position in flow s_flow, & !< start position in flow
offset !< stores leading '- ' in nested lists offset !< stores leading '- ' in nested lists
character(len=pStringLen) :: line character(len=:), allocatable :: line
integer :: e_blck,indent integer :: e_blck,indent
indent = indentDepth(blck(s_blck:),offset) indent = indentDepth(blck(s_blck:),offset)
@ -373,8 +380,6 @@ recursive subroutine lst(blck,flow,s_blck,s_flow,offset)
offset = 0 offset = 0
endif endif
else ! list item in the same line else ! list item in the same line
if(line(indentDepth(line)+2:indentDepth(line)+2) /= ' ') &
call IO_error(703,ext_msg=line)
line = line(indentDepth(line)+3:) line = line(indentDepth(line)+3:)
if(isScalar(line)) then if(isScalar(line)) then
call line_toFlow(flow,s_flow,line) call line_toFlow(flow,s_flow,line)
@ -419,7 +424,7 @@ recursive subroutine dct(blck,flow,s_blck,s_flow,offset)
s_flow, & !< start position in flow s_flow, & !< start position in flow
offset offset
character(len=pStringLen) :: line character(len=:), allocatable :: line
integer :: e_blck,indent integer :: e_blck,indent
logical :: previous_isKey logical :: previous_isKey
@ -490,7 +495,7 @@ recursive subroutine decide(blck,flow,s_blck,s_flow,offset)
s_flow, & !< start position in flow s_flow, & !< start position in flow
offset offset
integer :: e_blck integer :: e_blck
character(len=pStringLen) :: line character(len=:), allocatable :: line
if(s_blck <= len(blck)) then if(s_blck <= len(blck)) then
e_blck = s_blck + index(blck(s_blck:),IO_EOL) - 2 e_blck = s_blck + index(blck(s_blck:),IO_EOL) - 2
@ -564,8 +569,9 @@ subroutine selfTest()
if (.not. isFlow(' [')) call IO_error(0,ext_msg='isFlow') if (.not. isFlow(' [')) call IO_error(0,ext_msg='isFlow')
if ( isListItem(' a')) call IO_error(0,ext_msg='isListItem') if ( isListItem(' a')) call IO_error(0,ext_msg='isListItem')
if ( isListItem(' -b')) call IO_error(0,ext_msg='isListItem')
if (.not. isListItem('- a ')) call IO_error(0,ext_msg='isListItem') if (.not. isListItem('- a ')) call IO_error(0,ext_msg='isListItem')
if (.not. isListItem(' -b')) call IO_error(0,ext_msg='isListItem') if (.not. isListItem('- -a ')) call IO_error(0,ext_msg='isListItem')
if ( isKeyValue(' a')) call IO_error(0,ext_msg='isKeyValue') if ( isKeyValue(' a')) call IO_error(0,ext_msg='isKeyValue')
if ( isKeyValue(' a: ')) call IO_error(0,ext_msg='isKeyValue') if ( isKeyValue(' a: ')) call IO_error(0,ext_msg='isKeyValue')

View File

@ -8,12 +8,10 @@
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
module YAML_types module YAML_types
use IO use IO
use prec use prec
implicit none implicit none
private private
type, abstract, public :: tNode type, abstract, public :: tNode
@ -74,7 +72,7 @@ module YAML_types
getKey => tNode_getKey_byIndex getKey => tNode_getKey_byIndex
procedure :: & procedure :: &
contains => tNode_contains contains => tNode_contains
generic :: & generic :: &
get => tNode_get_byIndex, & get => tNode_get_byIndex, &
tNode_get_byKey tNode_get_byKey
@ -181,6 +179,7 @@ module YAML_types
public :: & public :: &
YAML_types_init, & YAML_types_init, &
output_asStrings, & !ToDo: Hack for GNU. Remove later
assignment(=) assignment(=)
contains contains
@ -210,9 +209,9 @@ subroutine selfTest
s1 = '1' s1 = '1'
if(s1%asInt() /= 1) call IO_error(0,ext_msg='tScalar_asInt') if(s1%asInt() /= 1) call IO_error(0,ext_msg='tScalar_asInt')
if(dNeq(s1%asFloat(),1.0_pReal)) call IO_error(0,ext_msg='tScalar_asFloat') if(dNeq(s1%asFloat(),1.0_pReal)) call IO_error(0,ext_msg='tScalar_asFloat')
s1 = 'True' s1 = 'true'
if(.not. s1%asBool()) call IO_error(0,ext_msg='tScalar_asBool') if(.not. s1%asBool()) call IO_error(0,ext_msg='tScalar_asBool')
if(s1%asString() /= 'True') call IO_error(0,ext_msg='tScalar_asString') if(s1%asString() /= 'true') call IO_error(0,ext_msg='tScalar_asString')
end select end select
block block
@ -259,7 +258,7 @@ subroutine selfTest
allocate(tScalar::s2) allocate(tScalar::s2)
s3 => s1%asScalar() s3 => s1%asScalar()
s4 => s2%asScalar() s4 => s2%asScalar()
s3 = 'True' s3 = 'true'
s4 = 'False' s4 = 'False'
call l1%append(s1) call l1%append(s1)
@ -267,9 +266,9 @@ subroutine selfTest
n => l1 n => l1
if(any(l1%asBools() .neqv. [.true., .false.])) call IO_error(0,ext_msg='tList_asBools') if(any(l1%asBools() .neqv. [.true., .false.])) call IO_error(0,ext_msg='tList_asBools')
if(any(l1%asStrings() /= ['True ','False'])) call IO_error(0,ext_msg='tList_asStrings') if(any(l1%asStrings() /= ['true ','False'])) call IO_error(0,ext_msg='tList_asStrings')
if(n%get_asBool(2)) call IO_error(0,ext_msg='byIndex_asBool') if(n%get_asBool(2)) call IO_error(0,ext_msg='byIndex_asBool')
if(n%get_asString(1) /= 'True') call IO_error(0,ext_msg='byIndex_asString') if(n%get_asString(1) /= 'true') call IO_error(0,ext_msg='byIndex_asString')
end block end block
end subroutine selfTest end subroutine selfTest
@ -710,7 +709,6 @@ function tNode_get_byKey_asFloat(self,k,defaultVal) result(nodeAsFloat)
else else
call IO_error(143,ext_msg=k) call IO_error(143,ext_msg=k)
endif endif
end function tNode_get_byKey_asFloat end function tNode_get_byKey_asFloat
@ -764,7 +762,6 @@ function tNode_get_byKey_asBool(self,k,defaultVal) result(nodeAsBool)
call IO_error(143,ext_msg=k) call IO_error(143,ext_msg=k)
endif endif
end function tNode_get_byKey_asBool end function tNode_get_byKey_asBool
@ -791,25 +788,37 @@ function tNode_get_byKey_asString(self,k,defaultVal) result(nodeAsString)
call IO_error(143,ext_msg=k) call IO_error(143,ext_msg=k)
endif endif
end function tNode_get_byKey_asString end function tNode_get_byKey_asString
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
!> @brief Access by key and convert to float array !> @brief Access by key and convert to float array
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
function tNode_get_byKey_asFloats(self,k) result(nodeAsFloats) function tNode_get_byKey_asFloats(self,k,defaultVal,requiredSize) result(nodeAsFloats)
class(tNode), intent(in), target :: self
character(len=*), intent(in) :: k
real(pReal), intent(in), dimension(:), optional :: defaultVal
integer, intent(in), optional :: requiredSize
class(tNode), intent(in), target :: self
character(len=*), intent(in) :: k
real(pReal), dimension(:), allocatable :: nodeAsFloats real(pReal), dimension(:), allocatable :: nodeAsFloats
class(tNode), pointer :: node class(tNode), pointer :: node
type(tList), pointer :: list type(tList), pointer :: list
node => self%get(k) if(self%contains(k)) then
list => node%asList() node => self%get(k)
nodeAsFloats = list%asFloats() list => node%asList()
nodeAsFloats = list%asFloats()
elseif(present(defaultVal)) then
nodeAsFloats = defaultVal
else
call IO_error(143,ext_msg=k)
endif
if(present(requiredSize)) then
if(requiredSize /= size(nodeAsFloats)) call IO_error(146,ext_msg=k)
endif
end function tNode_get_byKey_asFloats end function tNode_get_byKey_asFloats
@ -817,18 +826,30 @@ end function tNode_get_byKey_asFloats
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
!> @brief Access by key and convert to int array !> @brief Access by key and convert to int array
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
function tNode_get_byKey_asInts(self,k) result(nodeAsInts) function tNode_get_byKey_asInts(self,k,defaultVal,requiredSize) result(nodeAsInts)
class(tNode), intent(in), target :: self class(tNode), intent(in), target :: self
character(len=*), intent(in) :: k character(len=*), intent(in) :: k
integer, dimension(:), intent(in), optional :: defaultVal
integer, intent(in), optional :: requiredSize
integer, dimension(:), allocatable :: nodeAsInts integer, dimension(:), allocatable :: nodeAsInts
class(tNode), pointer :: node class(tNode), pointer :: node
type(tList), pointer :: list type(tList), pointer :: list
node => self%get(k) if(self%contains(k)) then
list => node%asList() node => self%get(k)
nodeAsInts = list%asInts() list => node%asList()
nodeAsInts = list%asInts()
elseif(present(defaultVal)) then
nodeAsInts = defaultVal
else
call IO_error(143,ext_msg=k)
endif
if(present(requiredSize)) then
if(requiredSize /= size(nodeAsInts)) call IO_error(146,ext_msg=k)
endif
end function tNode_get_byKey_asInts end function tNode_get_byKey_asInts
@ -836,18 +857,25 @@ end function tNode_get_byKey_asInts
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
!> @brief Access by key and convert to bool array !> @brief Access by key and convert to bool array
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
function tNode_get_byKey_asBools(self,k) result(nodeAsBools) function tNode_get_byKey_asBools(self,k,defaultVal) result(nodeAsBools)
class(tNode), intent(in), target :: self class(tNode), intent(in), target :: self
character(len=*), intent(in) :: k character(len=*), intent(in) :: k
logical, dimension(:), allocatable :: nodeAsBools logical, dimension(:), intent(in), optional :: defaultVal
logical, dimension(:), allocatable :: nodeAsBools
class(tNode), pointer :: node class(tNode), pointer :: node
type(tList), pointer :: list type(tList), pointer :: list
node => self%get(k) if(self%contains(k)) then
list => node%asList() node => self%get(k)
nodeAsBools = list%asBools() list => node%asList()
nodeAsBools = list%asBools()
elseif(present(defaultVal)) then
nodeAsBools = defaultVal
else
call IO_error(143,ext_msg=k)
endif
end function tNode_get_byKey_asBools end function tNode_get_byKey_asBools
@ -855,22 +883,50 @@ end function tNode_get_byKey_asBools
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
!> @brief Access by key and convert to string array !> @brief Access by key and convert to string array
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
function tNode_get_byKey_asStrings(self,k) result(nodeAsStrings) function tNode_get_byKey_asStrings(self,k,defaultVal) result(nodeAsStrings)
class(tNode), intent(in), target :: self class(tNode), intent(in), target :: self
character(len=*), intent(in) :: k character(len=*), intent(in) :: k
character(len=:), allocatable, dimension(:) :: nodeAsStrings character(len=*), intent(in), dimension(:), optional :: defaultVal
character(len=:), allocatable, dimension(:) :: nodeAsStrings
class(tNode), pointer :: node class(tNode), pointer :: node
type(tList), pointer :: list type(tList), pointer :: list
node => self%get(k) if(self%contains(k)) then
list => node%asList() node => self%get(k)
nodeAsStrings = list%asStrings() list => node%asList()
nodeAsStrings = list%asStrings()
elseif(present(defaultVal)) then
nodeAsStrings = defaultVal
else
call IO_error(143,ext_msg=k)
endif
end function tNode_get_byKey_asStrings end function tNode_get_byKey_asStrings
!--------------------------------------------------------------------------------------------------
!> @brief Returns string output array (hack for GNU)
!--------------------------------------------------------------------------------------------------
function output_asStrings(self) result(output) !ToDo: SR: Remove whenever GNU works
class(tNode), pointer,intent(in) :: self
character(len=pStringLen), allocatable, dimension(:) :: output
class(tNode), pointer :: output_list
integer :: o
output_list => self%get('output',defaultVal=emptyList)
allocate(output(output_list%length))
do o = 1, output_list%length
output(o) = output_list%get_asString(o)
enddo
end function output_asStrings
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
!> @brief Returns the index of a key in a dictionary !> @brief Returns the index of a key in a dictionary
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------

View File

@ -6,9 +6,6 @@
#include "IO.f90" #include "IO.f90"
#include "YAML_types.f90" #include "YAML_types.f90"
#include "YAML_parse.f90" #include "YAML_parse.f90"
#include "numerics.f90"
#include "debug.f90"
#include "list.f90"
#include "future.f90" #include "future.f90"
#include "config.f90" #include "config.f90"
#include "LAPACK_interface.f90" #include "LAPACK_interface.f90"
@ -33,7 +30,7 @@
#include "constitutive_plastic_phenopowerlaw.f90" #include "constitutive_plastic_phenopowerlaw.f90"
#include "constitutive_plastic_kinehardening.f90" #include "constitutive_plastic_kinehardening.f90"
#include "constitutive_plastic_dislotwin.f90" #include "constitutive_plastic_dislotwin.f90"
#include "constitutive_plastic_disloUCLA.f90" #include "constitutive_plastic_disloTungsten.f90"
#include "constitutive_plastic_nonlocal.f90" #include "constitutive_plastic_nonlocal.f90"
#include "constitutive_thermal.f90" #include "constitutive_thermal.f90"
#include "source_thermal_dissipation.f90" #include "source_thermal_dissipation.f90"

View File

@ -1,35 +1,36 @@
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
!> @author Martin Diehl, Max-Planck-Institut für Eisenforschung GmbH !> @author Martin Diehl, Max-Planck-Institut für Eisenforschung GmbH
!> @brief Reads in the material configuration from file !> @brief Reads in the material, numerics & debug configuration from their respective file
!> @details Reads the material configuration file, where solverJobName.materialConfig takes !> @details Reads the material configuration file, where solverJobName.yaml takes
!! precedence over material.config. Stores the raw strings and the positions of delimiters for the !! precedence over material.yaml.
!! parts 'homogenization', 'crystallite', 'phase', 'texture', and 'microstucture'
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
module config module config
use prec use prec
use DAMASK_interface use DAMASK_interface
use IO use IO
use debug
use list
use YAML_parse use YAML_parse
use YAML_types use YAML_types
#ifdef PETSc
#include <petsc/finclude/petscsys.h>
use petscsys
#endif
!$ use OMP_LIB
implicit none implicit none
private private
type(tPartitionedStringList), public, protected, allocatable, dimension(:) :: & class(tNode), pointer, public :: &
config_phase, & material_root, &
config_microstructure, & numerics_root, &
config_homogenization, & debug_root
config_texture, &
config_crystallite integer, protected, public :: &
worldrank = 0, & !< MPI worldrank (/=0 for MPI simulations only)
worldsize = 1 !< MPI worldsize (/=1 for MPI simulations only)
integer(4), protected, public :: &
DAMASK_NumThreadsInt = 0 !< value stored in environment variable DAMASK_NUM_THREADS, set to zero if no OpenMP directive
character(len=pStringLen), public, protected, allocatable, dimension(:) :: &
config_name_phase, & !< name of each phase
config_name_homogenization, & !< name of each homogenization
config_name_crystallite, & !< name of each crystallite setting
config_name_microstructure, & !< name of each microstructure
config_name_texture !< name of each texture
public :: & public :: &
config_init, & config_init, &
@ -38,227 +39,117 @@ module config
contains contains
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
!> @brief reads material.config and stores its content per part !> @brief calls subroutines that reads material, numerics and debug configuration files
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
subroutine config_init subroutine config_init
integer :: i
logical :: verbose
character(len=pStringLen) :: &
line, &
part
character(len=pStringLen), dimension(:), allocatable :: fileContent
class(tNode), pointer :: &
debug_material
logical :: fileExists
write(6,'(/,a)') ' <<<+- config init -+>>>'; flush(6) write(6,'(/,a)') ' <<<+- config init -+>>>'; flush(6)
debug_material => debug_root%get('material',defaultVal=emptyList)
verbose = debug_material%contains('basic')
inquire(file=trim(getSolverJobName())//'.materialConfig',exist=fileExists)
if(fileExists) then
write(6,'(/,a)') ' reading '//trim(getSolverJobName())//'.materialConfig'; flush(6)
fileContent = read_materialConfig(trim(getSolverJobName())//'.materialConfig')
else
inquire(file='material.config',exist=fileExists)
if(.not. fileExists) call IO_error(100,ext_msg='material.config')
write(6,'(/,a)') ' reading material.config'; flush(6)
fileContent = read_materialConfig('material.config')
endif
do i = 1, size(fileContent)
line = trim(fileContent(i))
part = IO_lc(IO_getTag(line,'<','>'))
select case (trim(part))
case (trim('phase'))
call parse_materialConfig(config_name_phase,config_phase,line,fileContent(i+1:))
if (verbose) write(6,'(a)') ' Phase parsed'; flush(6)
case (trim('microstructure'))
call parse_materialConfig(config_name_microstructure,config_microstructure,line,fileContent(i+1:))
if (verbose) write(6,'(a)') ' Microstructure parsed'; flush(6)
case (trim('crystallite'))
call parse_materialConfig(config_name_crystallite,config_crystallite,line,fileContent(i+1:))
if (verbose) write(6,'(a)') ' Crystallite parsed'; flush(6)
deallocate(config_crystallite)
case (trim('homogenization'))
call parse_materialConfig(config_name_homogenization,config_homogenization,line,fileContent(i+1:))
if (verbose) write(6,'(a)') ' Homogenization parsed'; flush(6)
case (trim('texture'))
call parse_materialConfig(config_name_texture,config_texture,line,fileContent(i+1:))
if (verbose) write(6,'(a)') ' Texture parsed'; flush(6)
end select
enddo
if (.not. allocated(config_homogenization) .or. size(config_homogenization) < 1) &
call IO_error(160,ext_msg='<homogenization>')
if (.not. allocated(config_microstructure) .or. size(config_microstructure) < 1) &
call IO_error(160,ext_msg='<microstructure>')
if (.not. allocated(config_phase) .or. size(config_phase) < 1) &
call IO_error(160,ext_msg='<phase>')
if (.not. allocated(config_texture) .or. size(config_texture) < 1) &
call IO_error(160,ext_msg='<texture>')
contains
!--------------------------------------------------------------------------------------------------
!> @brief reads material.config
!! Recursion is triggered by "{path/to/inputfile}" in a line
!--------------------------------------------------------------------------------------------------
recursive function read_materialConfig(fileName,cnt) result(fileContent)
character(len=*), intent(in) :: fileName !< name of the material configuration file
integer, intent(in), optional :: cnt !< recursion counter
character(len=pStringLen), dimension(:), allocatable :: fileContent !< file content, separated per lines
character(len=pStringLen), dimension(:), allocatable :: includedContent
character(len=pStringLen) :: line
character(len=pStringLen), parameter :: dummy = 'https://damask.mpie.de' !< to fill up remaining array
character(len=:), allocatable :: rawData
integer :: &
startPos, endPos, &
myTotalLines, & !< # lines read from file without include statements
l,i
logical :: warned
if (present(cnt)) then call parse_material
if (cnt>10) call IO_error(106,ext_msg=trim(fileName)) call parse_numerics
endif call parse_debug
rawData = IO_read(fileName) ! read data as stream
!--------------------------------------------------------------------------------------------------
! count lines to allocate string array
myTotalLines = 1
do l=1, len(rawData)
if (rawData(l:l) == IO_EOL) myTotalLines = myTotalLines+1
enddo
allocate(fileContent(myTotalLines))
!--------------------------------------------------------------------------------------------------
! split raw data at end of line and handle includes
warned = .false.
startPos = 1
l = 1
do while (l <= myTotalLines)
endPos = merge(startPos + scan(rawData(startPos:),IO_EOL) - 2,len(rawData),l /= myTotalLines)
if (endPos - startPos > pStringLen -1) then
line = rawData(startPos:startPos+pStringLen-1)
if (.not. warned) then
call IO_warning(207,ext_msg=trim(fileName),el=l)
warned = .true.
endif
else
line = rawData(startPos:endpos)
endif
startPos = endPos + 2 ! jump to next line start
recursion: if (scan(trim(adjustl(line)),'{') == 1 .and. scan(trim(line),'}') > 2) then
includedContent = read_materialConfig(trim(line(scan(line,'{')+1:scan(line,'}')-1)), &
merge(cnt,1,present(cnt))) ! to track recursion depth
fileContent = [ fileContent(1:l-1), includedContent, [(dummy,i=1,myTotalLines-l)] ] ! add content and grow array
myTotalLines = myTotalLines - 1 + size(includedContent)
l = l - 1 + size(includedContent)
else recursion
fileContent(l) = line
l = l + 1
endif recursion
enddo
end function read_materialConfig
!--------------------------------------------------------------------------------------------------
!> @brief parses the material.config file
!--------------------------------------------------------------------------------------------------
subroutine parse_materialConfig(sectionNames,part,line, &
fileContent)
character(len=pStringLen), allocatable, dimension(:), intent(out) :: sectionNames
type(tPartitionedStringList), allocatable, dimension(:), intent(inout) :: part
character(len=pStringLen), intent(inout) :: line
character(len=pStringLen), dimension(:), intent(in) :: fileContent
integer, allocatable, dimension(:) :: partPosition !< position of [] tags + last line in section
integer :: i, j
logical :: echo
character(len=pStringLen) :: sectionName
echo = .false.
if (allocated(part)) call IO_error(161,ext_msg=trim(line))
allocate(partPosition(0))
do i = 1, size(fileContent)
line = trim(fileContent(i))
if (IO_getTag(line,'<','>') /= '') exit
nextSection: if (IO_getTag(line,'[',']') /= '') then
partPosition = [partPosition, i]
cycle
endif nextSection
if (size(partPosition) < 1) &
echo = (trim(IO_getTag(line,'/','/')) == 'echo') .or. echo
enddo
allocate(sectionNames(size(partPosition)))
allocate(part(size(partPosition)))
partPosition = [partPosition, i] ! needed when actually storing content
do i = 1, size(partPosition) -1
write(sectionName,'(i0,a,a)') i,'_',trim(IO_getTag(fileContent(partPosition(i)),'[',']'))
sectionNames(i) = sectionName
do j = partPosition(i) + 1, partPosition(i+1) -1
call part(i)%add(trim(adjustl(fileContent(j))))
enddo
if (echo) then
write(6,*) 'section',i, '"'//trim(sectionNames(i))//'"'
call part(i)%show()
endif
enddo
end subroutine parse_materialConfig
end subroutine config_init end subroutine config_init
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
!> @brief deallocates the linked lists that store the content of the configuration files !> @brief reads material.yaml
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
subroutine config_deallocate(what) subroutine parse_material
character(len=*), intent(in) :: what logical :: fileExists
character(len=:), allocatable :: fname,flow
select case(trim(what)) fname = getSolverJobName()//'.yaml'
inquire(file=fname,exist=fileExists)
if(.not. fileExists) then
fname = 'material.yaml'
inquire(file=fname,exist=fileExists)
if(.not. fileExists) call IO_error(100,ext_msg=fname)
endif
case('material.config/phase') write(6,'(/,a)') ' reading '//fname; flush(6)
deallocate(config_phase) flow = to_flow(IO_read(fname))
material_root => parse_flow(flow)
case('material.config/microstructure') end subroutine parse_material
deallocate(config_microstructure)
case('material.config/homogenization')
deallocate(config_homogenization)
case('material.config/texture') !--------------------------------------------------------------------------------------------------
deallocate(config_texture) !> @brief reads in parameters from numerics.yaml and sets openMP related parameters. Also does
! a sanity check
case default !--------------------------------------------------------------------------------------------------
call IO_error(0,ext_msg='config_deallocate') subroutine parse_numerics
end select !$ integer :: gotDAMASK_NUM_THREADS = 1
integer :: ierr
character(len=:), allocatable :: &
numerics_inFlow
logical :: fexist
!$ character(len=6) DAMASK_NumThreadsString ! environment variable DAMASK_NUM_THREADS
#ifdef PETSc
call MPI_Comm_rank(PETSC_COMM_WORLD,worldrank,ierr);CHKERRQ(ierr)
call MPI_Comm_size(PETSC_COMM_WORLD,worldsize,ierr);CHKERRQ(ierr)
#endif
!$ call GET_ENVIRONMENT_VARIABLE(NAME='DAMASK_NUM_THREADS',VALUE=DAMASK_NumThreadsString,STATUS=gotDAMASK_NUM_THREADS) ! get environment variable DAMASK_NUM_THREADS...
!$ if(gotDAMASK_NUM_THREADS /= 0) then ! could not get number of threads, set it to 1
!$ call IO_warning(35,ext_msg='BEGIN:'//DAMASK_NumThreadsString//':END')
!$ DAMASK_NumThreadsInt = 1_4
!$ else
!$ read(DAMASK_NumThreadsString,'(i6)') DAMASK_NumThreadsInt ! read as integer
!$ if (DAMASK_NumThreadsInt < 1_4) DAMASK_NumThreadsInt = 1_4 ! in case of string conversion fails, set it to one
!$ endif
!$ call omp_set_num_threads(DAMASK_NumThreadsInt) ! set number of threads for parallel execution
numerics_root => emptyDict
inquire(file='numerics.yaml', exist=fexist)
if (fexist) then
write(6,'(a,/)') ' using values from config.yaml file'
flush(6)
numerics_inFlow = to_flow(IO_read('numerics.yaml'))
numerics_root => parse_flow(numerics_inFlow)
endif
!--------------------------------------------------------------------------------------------------
! openMP parameter
!$ write(6,'(a24,1x,i8,/)') ' number of threads: ',DAMASK_NumThreadsInt
end subroutine parse_numerics
!--------------------------------------------------------------------------------------------------
!> @brief reads in parameters from debug.yaml
!--------------------------------------------------------------------------------------------------
subroutine parse_debug
character(len=:), allocatable :: debug_inFlow
logical :: fexist
#ifdef DEBUG
write(6,'(a)') achar(27)//'[31m <<<+- DEBUG version -+>>>'//achar(27)//'[0m'
#endif
debug_root => emptyDict
inquire(file='debug.yaml', exist=fexist)
fileExists: if (fexist) then
debug_inFlow = to_flow(IO_read('debug.yaml'))
debug_root => parse_flow(debug_inFlow)
endif fileExists
end subroutine parse_debug
!--------------------------------------------------------------------------------------------------
!> @brief deallocates material.yaml structure
!--------------------------------------------------------------------------------------------------
subroutine config_deallocate
deallocate(material_root) !ToDo: deallocation of numerics and debug (slightly different for optional files)
end subroutine config_deallocate end subroutine config_deallocate
end module config end module config

View File

@ -7,8 +7,6 @@ module constitutive
use prec use prec
use math use math
use rotations use rotations
use debug
use numerics
use IO use IO
use config use config
use material use material
@ -21,6 +19,33 @@ module constitutive
implicit none implicit none
private private
integer(kind(ELASTICITY_undefined_ID)), dimension(:), allocatable, protected :: &
phase_elasticity !< elasticity of each phase
integer(kind(PLASTICITY_undefined_ID)), dimension(:), allocatable :: & !ToDo: old intel compiler complains about protected
phase_plasticity !< plasticity of each phase
integer(kind(SOURCE_undefined_ID)), dimension(:,:), allocatable :: & ! ToDo: old intel compiler complains about protected
phase_source, & !< active sources mechanisms of each phase
phase_kinematics, & !< active kinematic mechanisms of each phase
phase_stiffnessDegradation !< active stiffness degradation mechanisms of each phase
integer, dimension(:), allocatable, public :: & ! ToDo: old intel compiler complains about protected
phase_Nsources, & !< number of source mechanisms active in each phase
phase_Nkinematics, & !< number of kinematic mechanisms active in each phase
phase_NstiffnessDegradations, & !< number of stiffness degradation mechanisms active in each phase
phase_plasticityInstance, & !< instance of particular plasticity of each phase
phase_elasticityInstance !< instance of particular elasticity of each phase
logical, dimension(:), allocatable, public :: & ! ToDo: old intel compiler complains about protected
phase_localPlasticity !< flags phases with local constitutive law
type(tPlasticState), allocatable, dimension(:), public :: &
plasticState
type(tSourceState), allocatable, dimension(:), public :: &
sourceState
integer, public, protected :: & integer, public, protected :: &
constitutive_plasticity_maxSizeDotState, & constitutive_plasticity_maxSizeDotState, &
constitutive_source_maxSizeDotState constitutive_source_maxSizeDotState
@ -37,6 +62,23 @@ module constitutive
end subroutine thermal_init end subroutine thermal_init
module function plastic_active(plastic_label) result(active_plastic)
character(len=*), intent(in) :: plastic_label
logical, dimension(:), allocatable :: active_plastic
end function plastic_active
module function source_active(source_label,src_length) result(active_source)
character(len=*), intent(in) :: source_label
integer, intent(in) :: src_length
logical, dimension(:,:), allocatable :: active_source
end function source_active
module function kinematics_active(kinematics_label,kinematics_length) result(active_kinematics)
character(len=*), intent(in) :: kinematics_label
integer, intent(in) :: kinematics_length
logical, dimension(:,:), allocatable :: active_kinematics
end function kinematics_active
module subroutine plastic_isotropic_dotState(Mp,instance,of) module subroutine plastic_isotropic_dotState(Mp,instance,of)
real(pReal), dimension(3,3), intent(in) :: & real(pReal), dimension(3,3), intent(in) :: &
Mp !< Mandel stress Mp !< Mandel stress
@ -71,7 +113,7 @@ module constitutive
of of
end subroutine plastic_dislotwin_dotState end subroutine plastic_dislotwin_dotState
module subroutine plastic_disloUCLA_dotState(Mp,T,instance,of) module subroutine plastic_disloTungsten_dotState(Mp,T,instance,of)
real(pReal), dimension(3,3), intent(in) :: & real(pReal), dimension(3,3), intent(in) :: &
Mp !< Mandel stress Mp !< Mandel stress
real(pReal), intent(in) :: & real(pReal), intent(in) :: &
@ -79,7 +121,7 @@ module constitutive
integer, intent(in) :: & integer, intent(in) :: &
instance, & instance, &
of of
end subroutine plastic_disloUCLA_dotState end subroutine plastic_disloTungsten_dotState
module subroutine plastic_nonlocal_dotState(Mp, F, Fp, Temperature,timestep, & module subroutine plastic_nonlocal_dotState(Mp, F, Fp, Temperature,timestep, &
instance,of,ip,el) instance,of,ip,el)
@ -286,7 +328,6 @@ module constitutive
end subroutine constitutive_plastic_LpAndItsTangents end subroutine constitutive_plastic_LpAndItsTangents
end interface constitutive_LpAndItsTangents end interface constitutive_LpAndItsTangents
interface constitutive_dependentState interface constitutive_dependentState
@ -326,11 +367,14 @@ module constitutive
constitutive_SandItsTangents, & constitutive_SandItsTangents, &
constitutive_collectDotState, & constitutive_collectDotState, &
constitutive_deltaState, & constitutive_deltaState, &
plastic_nonlocal_updateCompatibility, &
constitutive_damage_getRateAndItsTangents, & constitutive_damage_getRateAndItsTangents, &
constitutive_thermal_getRateAndItsTangents, & constitutive_thermal_getRateAndItsTangents, &
constitutive_results constitutive_results, &
constitutive_allocateState, &
plastic_nonlocal_updateCompatibility, &
plastic_active, &
source_active, &
kinematics_active
contains contains
@ -340,10 +384,15 @@ contains
subroutine constitutive_init subroutine constitutive_init
integer :: & integer :: &
ph, & !< counter in phase loop p, & !< counter in phase loop
s !< counter in source loop s, & !< counter in source loop
stiffDegradationCtr
class (tNode), pointer :: & class (tNode), pointer :: &
debug_constitutive debug_constitutive, &
phases, &
phase, &
elastic, &
stiffDegradation
debug_constitutive => debug_root%get('constitutive', defaultVal=emptyList) debug_constitutive => debug_root%get('constitutive', defaultVal=emptyList)
debugConstitutive%basic = debug_constitutive%contains('basic') debugConstitutive%basic = debug_constitutive%contains('basic')
@ -353,7 +402,46 @@ subroutine constitutive_init
debugConstitutive%ip = debug_root%get_asInt('integrationpoint',defaultVal = 1) debugConstitutive%ip = debug_root%get_asInt('integrationpoint',defaultVal = 1)
debugConstitutive%grain = debug_root%get_asInt('grain',defaultVal = 1) debugConstitutive%grain = debug_root%get_asInt('grain',defaultVal = 1)
!-------------------------------------------------------------------------------------------------
! initialize elasticity (hooke) !ToDO: Maybe move to elastic submodule along with function homogenizedC?
phases => material_root%get('phase')
allocate(phase_elasticity(phases%length), source = ELASTICITY_undefined_ID)
allocate(phase_elasticityInstance(phases%length), source = 0)
allocate(phase_NstiffnessDegradations(phases%length),source=0)
do p = 1, phases%length
phase => phases%get(p)
elastic => phase%get('elasticity')
if(elastic%get_asString('type') == 'hooke') then
phase_elasticity(p) = ELASTICITY_HOOKE_ID
else
call IO_error(200,ext_msg=elastic%get_asString('type'))
endif
stiffDegradation => phase%get('stiffness_degradation',defaultVal=emptyList) ! check for stiffness degradation mechanisms
phase_NstiffnessDegradations(p) = stiffDegradation%length
enddo
allocate(phase_stiffnessDegradation(maxval(phase_NstiffnessDegradations),phases%length), &
source=STIFFNESS_DEGRADATION_undefined_ID)
if(maxVal(phase_NstiffnessDegradations)/=0) then
do p = 1, phases%length
phase => phases%get(p)
stiffDegradation => phase%get('stiffness_degradation',defaultVal=emptyList)
do stiffDegradationCtr = 1, stiffDegradation%length
if(stiffDegradation%get_asString(stiffDegradationCtr) == 'damage') &
phase_stiffnessDegradation(stiffDegradationCtr,p) = STIFFNESS_DEGRADATION_damage_ID
enddo
enddo
endif
do p = 1, phases%length
phase_elasticityInstance(p) = count(phase_elasticity(1:p) == phase_elasticity(p))
enddo
!--------------------------------------------------------------------------------------------------
! initialize constitutive laws
call plastic_init call plastic_init
call damage_init call damage_init
call thermal_init call thermal_init
@ -361,23 +449,87 @@ subroutine constitutive_init
write(6,'(/,a)') ' <<<+- constitutive init -+>>>'; flush(6) write(6,'(/,a)') ' <<<+- constitutive init -+>>>'; flush(6)
constitutive_source_maxSizeDotState = 0 constitutive_source_maxSizeDotState = 0
PhaseLoop2:do ph = 1,material_Nphase PhaseLoop2:do p = 1,phases%length
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! partition and initialize state ! partition and initialize state
plasticState(ph)%partionedState0 = plasticState(ph)%state0 plasticState(p)%partionedState0 = plasticState(p)%state0
plasticState(ph)%state = plasticState(ph)%partionedState0 plasticState(p)%state = plasticState(p)%partionedState0
forall(s = 1:phase_Nsources(ph)) forall(s = 1:phase_Nsources(p))
sourceState(ph)%p(s)%partionedState0 = sourceState(ph)%p(s)%state0 sourceState(p)%p(s)%partionedState0 = sourceState(p)%p(s)%state0
sourceState(ph)%p(s)%state = sourceState(ph)%p(s)%partionedState0 sourceState(p)%p(s)%state = sourceState(p)%p(s)%partionedState0
end forall end forall
constitutive_source_maxSizeDotState = max(constitutive_source_maxSizeDotState, & constitutive_source_maxSizeDotState = max(constitutive_source_maxSizeDotState, &
maxval(sourceState(ph)%p%sizeDotState)) maxval(sourceState(p)%p%sizeDotState))
enddo PhaseLoop2 enddo PhaseLoop2
constitutive_plasticity_maxSizeDotState = maxval(plasticState%sizeDotState) constitutive_plasticity_maxSizeDotState = maxval(plasticState%sizeDotState)
end subroutine constitutive_init end subroutine constitutive_init
!--------------------------------------------------------------------------------------------------
!> @brief checks if a source mechanism is active or not
!--------------------------------------------------------------------------------------------------
module function source_active(source_label,src_length) result(active_source)
character(len=*), intent(in) :: source_label !< name of source mechanism
integer, intent(in) :: src_length !< max. number of sources in system
logical, dimension(:,:), allocatable :: active_source
class(tNode), pointer :: &
phases, &
phase, &
sources, &
src
integer :: p,s
phases => material_root%get('phase')
allocate(active_source(src_length,phases%length), source = .false. )
do p = 1, phases%length
phase => phases%get(p)
sources => phase%get('source',defaultVal=emptyList)
do s = 1, sources%length
src => sources%get(s)
if(src%get_asString('type') == source_label) active_source(s,p) = .true.
enddo
enddo
end function source_active
!--------------------------------------------------------------------------------------------------
!> @brief checks if a kinematic mechanism is active or not
!--------------------------------------------------------------------------------------------------
module function kinematics_active(kinematics_label,kinematics_length) result(active_kinematics)
character(len=*), intent(in) :: kinematics_label !< name of kinematic mechanism
integer, intent(in) :: kinematics_length !< max. number of kinematics in system
logical, dimension(:,:), allocatable :: active_kinematics
class(tNode), pointer :: &
phases, &
phase, &
kinematics, &
kinematics_type
integer :: p,k
phases => material_root%get('phase')
allocate(active_kinematics(kinematics_length,phases%length), source = .false. )
do p = 1, phases%length
phase => phases%get(p)
kinematics => phase%get('kinematics',defaultVal=emptyList)
do k = 1, kinematics%length
kinematics_type => kinematics%get(k)
if(kinematics_type%get_asString('type') == kinematics_label) active_kinematics(k,p) = .true.
enddo
enddo
end function kinematics_active
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
!> @brief returns the homogenize elasticity matrix !> @brief returns the homogenize elasticity matrix
!> ToDo: homogenizedC66 would be more consistent !> ToDo: homogenizedC66 would be more consistent
@ -626,7 +778,7 @@ function constitutive_collectDotState(S, FArray, Fi, FpArray, subdt, ipc, ip, el
plasticityType: select case (phase_plasticity(phase)) plasticityType: select case (phase_plasticity(phase))
case (PLASTICITY_ISOTROPIC_ID) plasticityType case (PLASTICITY_ISOTROPIC_ID) plasticityType
call plastic_isotropic_dotState (Mp,instance,of) call plastic_isotropic_dotState(Mp,instance,of)
case (PLASTICITY_PHENOPOWERLAW_ID) plasticityType case (PLASTICITY_PHENOPOWERLAW_ID) plasticityType
call plastic_phenopowerlaw_dotState(Mp,instance,of) call plastic_phenopowerlaw_dotState(Mp,instance,of)
@ -635,13 +787,13 @@ function constitutive_collectDotState(S, FArray, Fi, FpArray, subdt, ipc, ip, el
call plastic_kinehardening_dotState(Mp,instance,of) call plastic_kinehardening_dotState(Mp,instance,of)
case (PLASTICITY_DISLOTWIN_ID) plasticityType case (PLASTICITY_DISLOTWIN_ID) plasticityType
call plastic_dislotwin_dotState (Mp,temperature(ho)%p(tme),instance,of) call plastic_dislotwin_dotState(Mp,temperature(ho)%p(tme),instance,of)
case (PLASTICITY_DISLOUCLA_ID) plasticityType case (PLASTICITY_DISLOTUNGSTEN_ID) plasticityType
call plastic_disloucla_dotState (Mp,temperature(ho)%p(tme),instance,of) call plastic_disloTungsten_dotState(Mp,temperature(ho)%p(tme),instance,of)
case (PLASTICITY_NONLOCAL_ID) plasticityType case (PLASTICITY_NONLOCAL_ID) plasticityType
call plastic_nonlocal_dotState (Mp,FArray,FpArray,temperature(ho)%p(tme),subdt, & call plastic_nonlocal_dotState(Mp,FArray,FpArray,temperature(ho)%p(tme),subdt, &
instance,of,ip,el) instance,of,ip,el)
end select plasticityType end select plasticityType
broken = any(IEEE_is_NaN(plasticState(phase)%dotState(:,of))) broken = any(IEEE_is_NaN(plasticState(phase)%dotState(:,of)))
@ -651,13 +803,13 @@ function constitutive_collectDotState(S, FArray, Fi, FpArray, subdt, ipc, ip, el
sourceType: select case (phase_source(i,phase)) sourceType: select case (phase_source(i,phase))
case (SOURCE_damage_anisoBrittle_ID) sourceType case (SOURCE_damage_anisoBrittle_ID) sourceType
call source_damage_anisoBrittle_dotState (S, ipc, ip, el) ! correct stress? call source_damage_anisoBrittle_dotState(S, ipc, ip, el) ! correct stress?
case (SOURCE_damage_isoDuctile_ID) sourceType case (SOURCE_damage_isoDuctile_ID) sourceType
call source_damage_isoDuctile_dotState ( ipc, ip, el) call source_damage_isoDuctile_dotState(ipc, ip, el)
case (SOURCE_damage_anisoDuctile_ID) sourceType case (SOURCE_damage_anisoDuctile_ID) sourceType
call source_damage_anisoDuctile_dotState ( ipc, ip, el) call source_damage_anisoDuctile_dotState(ipc, ip, el)
case (SOURCE_thermal_externalheat_ID) sourceType case (SOURCE_thermal_externalheat_ID) sourceType
call source_thermal_externalheat_dotState(phase,of) call source_thermal_externalheat_dotState(phase,of)
@ -749,6 +901,39 @@ function constitutive_deltaState(S, Fe, Fi, ipc, ip, el, phase, of) result(broke
end function constitutive_deltaState end function constitutive_deltaState
!--------------------------------------------------------------------------------------------------
!> @brief Allocate the components of the state structure for a given phase
!--------------------------------------------------------------------------------------------------
subroutine constitutive_allocateState(state, &
NipcMyPhase,sizeState,sizeDotState,sizeDeltaState)
class(tState), intent(out) :: &
state
integer, intent(in) :: &
NipcMyPhase, &
sizeState, &
sizeDotState, &
sizeDeltaState
state%sizeState = sizeState
state%sizeDotState = sizeDotState
state%sizeDeltaState = sizeDeltaState
state%offsetDeltaState = sizeState-sizeDeltaState ! deltaState occupies latter part of state by definition
allocate(state%atol (sizeState), source=0.0_pReal)
allocate(state%state0 (sizeState,NipcMyPhase), source=0.0_pReal)
allocate(state%partionedState0(sizeState,NipcMyPhase), source=0.0_pReal)
allocate(state%subState0 (sizeState,NipcMyPhase), source=0.0_pReal)
allocate(state%state (sizeState,NipcMyPhase), source=0.0_pReal)
allocate(state%dotState (sizeDotState,NipcMyPhase), source=0.0_pReal)
allocate(state%deltaState(sizeDeltaState,NipcMyPhase), source=0.0_pReal)
end subroutine constitutive_allocateState
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
!> @brief writes constitutive results to HDF5 output file !> @brief writes constitutive results to HDF5 output file
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
@ -759,4 +944,5 @@ subroutine constitutive_results
end subroutine constitutive_results end subroutine constitutive_results
end module constitutive end module constitutive

View File

@ -5,23 +5,35 @@ submodule(constitutive) constitutive_damage
interface interface
module subroutine source_damage_anisoBrittle_init module function source_damage_anisoBrittle_init(source_length) result(mySources)
end subroutine source_damage_anisoBrittle_init integer, intent(in) :: source_length
logical, dimension(:,:), allocatable :: mySources
end function source_damage_anisoBrittle_init
module subroutine source_damage_anisoDuctile_init module function source_damage_anisoDuctile_init(source_length) result(mySources)
end subroutine source_damage_anisoDuctile_init integer, intent(in) :: source_length
logical, dimension(:,:), allocatable :: mySources
end function source_damage_anisoDuctile_init
module subroutine source_damage_isoBrittle_init module function source_damage_isoBrittle_init(source_length) result(mySources)
end subroutine source_damage_isoBrittle_init integer, intent(in) :: source_length
logical, dimension(:,:), allocatable :: mySources
end function source_damage_isoBrittle_init
module subroutine source_damage_isoDuctile_init module function source_damage_isoDuctile_init(source_length) result(mySources)
end subroutine source_damage_isoDuctile_init integer, intent(in) :: source_length
logical, dimension(:,:), allocatable :: mySources
end function source_damage_isoDuctile_init
module subroutine kinematics_cleavage_opening_init module function kinematics_cleavage_opening_init(kinematics_length) result(myKinematics)
end subroutine kinematics_cleavage_opening_init integer, intent(in) :: kinematics_length
logical, dimension(:,:), allocatable :: myKinematics
end function kinematics_cleavage_opening_init
module subroutine kinematics_slipplane_opening_init module function kinematics_slipplane_opening_init(kinematics_length) result(myKinematics)
end subroutine kinematics_slipplane_opening_init integer, intent(in) :: kinematics_length
logical, dimension(:,:), allocatable :: myKinematics
end function kinematics_slipplane_opening_init
module subroutine source_damage_anisobrittle_getRateAndItsTangent(localphiDot, dLocalphiDot_dPhi, phi, phase, constituent) module subroutine source_damage_anisobrittle_getRateAndItsTangent(localphiDot, dLocalphiDot_dPhi, phi, phase, constituent)
@ -97,16 +109,51 @@ contains
!---------------------------------------------------------------------------------------------- !----------------------------------------------------------------------------------------------
module subroutine damage_init module subroutine damage_init
integer :: &
ph !< counter in phase loop
class(tNode), pointer :: &
phases, &
phase, &
sources, &
kinematics
phases => material_root%get('phase')
allocate(sourceState (phases%length))
allocate(phase_Nsources(phases%length),source = 0) ! same for kinematics
do ph = 1,phases%length
phase => phases%get(ph)
sources => phase%get('source',defaultVal=emptyList)
phase_Nsources(ph) = sources%length
allocate(sourceState(ph)%p(phase_Nsources(ph)))
enddo
allocate(phase_source(maxval(phase_Nsources),phases%length), source = SOURCE_undefined_ID)
! initialize source mechanisms ! initialize source mechanisms
if (any(phase_source == SOURCE_damage_isoBrittle_ID)) call source_damage_isoBrittle_init if(maxval(phase_Nsources) /= 0) then
if (any(phase_source == SOURCE_damage_isoDuctile_ID)) call source_damage_isoDuctile_init where(source_damage_isoBrittle_init (maxval(phase_Nsources))) phase_source = SOURCE_damage_isoBrittle_ID
if (any(phase_source == SOURCE_damage_anisoBrittle_ID)) call source_damage_anisoBrittle_init where(source_damage_isoDuctile_init (maxval(phase_Nsources))) phase_source = SOURCE_damage_isoDuctile_ID
if (any(phase_source == SOURCE_damage_anisoDuctile_ID)) call source_damage_anisoDuctile_init where(source_damage_anisoBrittle_init (maxval(phase_Nsources))) phase_source = SOURCE_damage_anisoBrittle_ID
where(source_damage_anisoDuctile_init (maxval(phase_Nsources))) phase_source = SOURCE_damage_anisoDuctile_ID
endif
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! initialize kinematic mechanisms ! initialize kinematic mechanisms
if (any(phase_kinematics == KINEMATICS_cleavage_opening_ID)) call kinematics_cleavage_opening_init allocate(phase_Nkinematics(phases%length),source = 0)
if (any(phase_kinematics == KINEMATICS_slipplane_opening_ID)) call kinematics_slipplane_opening_init do ph = 1,phases%length
phase => phases%get(ph)
kinematics => phase%get('kinematics',defaultVal=emptyList)
phase_Nkinematics(ph) = kinematics%length
enddo
allocate(phase_kinematics(maxval(phase_Nkinematics),phases%length), source = KINEMATICS_undefined_ID)
if(maxval(phase_Nkinematics) /= 0) then
where(kinematics_cleavage_opening_init(maxval(phase_Nkinematics))) phase_kinematics = KINEMATICS_cleavage_opening_ID
where(kinematics_slipplane_opening_init(maxval(phase_Nkinematics))) phase_kinematics = KINEMATICS_slipplane_opening_ID
endif
end subroutine damage_init end subroutine damage_init
@ -168,16 +215,17 @@ end subroutine constitutive_damage_getRateAndItsTangents
!---------------------------------------------------------------------------------------------- !----------------------------------------------------------------------------------------------
!< @brief writes damage sources resultsvto HDF5 output file !< @brief writes damage sources results to HDF5 output file
!---------------------------------------------------------------------------------------------- !----------------------------------------------------------------------------------------------
module subroutine damage_results module subroutine damage_results
integer :: p,i integer :: p,i
character(len=pStringLen) :: group character(len=pStringLen) :: group
do p = 1, size(config_name_phase) do p = 1, size(material_name_phase)
sourceLoop: do i = 1, phase_Nsources(p) sourceLoop: do i = 1, phase_Nsources(p)
group = trim('current/constituent')//'/'//trim(config_name_phase(p)) group = trim('current/constituent')//'/'//trim(material_name_phase(p))
group = trim(group)//'/sources' group = trim(group)//'/sources'
call results_closeGroup(results_addGroup(group)) call results_closeGroup(results_addGroup(group))

View File

@ -5,26 +5,40 @@ submodule(constitutive) constitutive_plastic
interface interface
module subroutine plastic_none_init module function plastic_none_init() result(myPlasticity)
end subroutine plastic_none_init logical, dimension(:), allocatable :: &
myPlasticity
end function plastic_none_init
module subroutine plastic_isotropic_init module function plastic_isotropic_init() result(myPlasticity)
end subroutine plastic_isotropic_init logical, dimension(:), allocatable :: &
myPlasticity
end function plastic_isotropic_init
module subroutine plastic_phenopowerlaw_init module function plastic_phenopowerlaw_init() result(myPlasticity)
end subroutine plastic_phenopowerlaw_init logical, dimension(:), allocatable :: &
myPlasticity
end function plastic_phenopowerlaw_init
module subroutine plastic_kinehardening_init module function plastic_kinehardening_init() result(myPlasticity)
end subroutine plastic_kinehardening_init logical, dimension(:), allocatable :: &
myPlasticity
end function plastic_kinehardening_init
module subroutine plastic_dislotwin_init module function plastic_dislotwin_init() result(myPlasticity)
end subroutine plastic_dislotwin_init logical, dimension(:), allocatable :: &
myPlasticity
end function plastic_dislotwin_init
module subroutine plastic_disloUCLA_init module function plastic_disloTungsten_init() result(myPlasticity)
end subroutine plastic_disloUCLA_init logical, dimension(:), allocatable :: &
myPlasticity
end function plastic_disloTungsten_init
module subroutine plastic_nonlocal_init module function plastic_nonlocal_init() result(myPlasticity)
end subroutine plastic_nonlocal_init logical, dimension(:), allocatable :: &
myPlasticity
end function plastic_nonlocal_init
module subroutine plastic_isotropic_LpAndItsTangent(Lp,dLp_dMp,Mp,instance,of) module subroutine plastic_isotropic_LpAndItsTangent(Lp,dLp_dMp,Mp,instance,of)
@ -80,7 +94,7 @@ submodule(constitutive) constitutive_plastic
of of
end subroutine plastic_dislotwin_LpAndItsTangent end subroutine plastic_dislotwin_LpAndItsTangent
pure module subroutine plastic_disloUCLA_LpAndItsTangent(Lp,dLp_dMp,Mp,T,instance,of) pure module subroutine plastic_disloTungsten_LpAndItsTangent(Lp,dLp_dMp,Mp,T,instance,of)
real(pReal), dimension(3,3), intent(out) :: & real(pReal), dimension(3,3), intent(out) :: &
Lp !< plastic velocity gradient Lp !< plastic velocity gradient
real(pReal), dimension(3,3,3,3), intent(out) :: & real(pReal), dimension(3,3,3,3), intent(out) :: &
@ -93,7 +107,7 @@ submodule(constitutive) constitutive_plastic
integer, intent(in) :: & integer, intent(in) :: &
instance, & instance, &
of of
end subroutine plastic_disloUCLA_LpAndItsTangent end subroutine plastic_disloTungsten_LpAndItsTangent
module subroutine plastic_nonlocal_LpAndItsTangent(Lp,dLp_dMp, & module subroutine plastic_nonlocal_LpAndItsTangent(Lp,dLp_dMp, &
Mp,Temperature,instance,of,ip,el) Mp,Temperature,instance,of,ip,el)
@ -122,11 +136,11 @@ submodule(constitutive) constitutive_plastic
T T
end subroutine plastic_dislotwin_dependentState end subroutine plastic_dislotwin_dependentState
module subroutine plastic_disloUCLA_dependentState(instance,of) module subroutine plastic_disloTungsten_dependentState(instance,of)
integer, intent(in) :: & integer, intent(in) :: &
instance, & instance, &
of of
end subroutine plastic_disloUCLA_dependentState end subroutine plastic_disloTungsten_dependentState
module subroutine plastic_nonlocal_dependentState(F, Fp, instance, of, ip, el) module subroutine plastic_nonlocal_dependentState(F, Fp, instance, of, ip, el)
real(pReal), dimension(3,3), intent(in) :: & real(pReal), dimension(3,3), intent(in) :: &
@ -159,10 +173,10 @@ submodule(constitutive) constitutive_plastic
character(len=*), intent(in) :: group character(len=*), intent(in) :: group
end subroutine plastic_dislotwin_results end subroutine plastic_dislotwin_results
module subroutine plastic_disloUCLA_results(instance,group) module subroutine plastic_disloTungsten_results(instance,group)
integer, intent(in) :: instance integer, intent(in) :: instance
character(len=*), intent(in) :: group character(len=*), intent(in) :: group
end subroutine plastic_disloUCLA_results end subroutine plastic_disloTungsten_results
module subroutine plastic_nonlocal_results(instance,group) module subroutine plastic_nonlocal_results(instance,group)
integer, intent(in) :: instance integer, intent(in) :: instance
@ -181,21 +195,57 @@ contains
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
module subroutine plastic_init module subroutine plastic_init
if (any(phase_plasticity == PLASTICITY_NONE_ID)) call plastic_none_init integer :: p
if (any(phase_plasticity == PLASTICITY_ISOTROPIC_ID)) call plastic_isotropic_init class(tNode), pointer :: phases
if (any(phase_plasticity == PLASTICITY_PHENOPOWERLAW_ID)) call plastic_phenopowerlaw_init
if (any(phase_plasticity == PLASTICITY_KINEHARDENING_ID)) call plastic_kinehardening_init phases => material_root%get('phase')
if (any(phase_plasticity == PLASTICITY_DISLOTWIN_ID)) call plastic_dislotwin_init
if (any(phase_plasticity == PLASTICITY_DISLOUCLA_ID)) call plastic_disloucla_init allocate(plasticState(phases%length))
if (any(phase_plasticity == PLASTICITY_NONLOCAL_ID)) then allocate(phase_plasticity(phases%length),source = PLASTICITY_undefined_ID)
call plastic_nonlocal_init allocate(phase_plasticityInstance(phases%length),source = 0)
else allocate(phase_localPlasticity(phases%length), source=.true.)
call geometry_plastic_nonlocal_disable
endif where(plastic_none_init()) phase_plasticity = PLASTICITY_NONE_ID
where(plastic_isotropic_init()) phase_plasticity = PLASTICITY_ISOTROPIC_ID
where(plastic_phenopowerlaw_init()) phase_plasticity = PLASTICITY_PHENOPOWERLAW_ID
where(plastic_kinehardening_init()) phase_plasticity = PLASTICITY_KINEHARDENING_ID
where(plastic_dislotwin_init()) phase_plasticity = PLASTICITY_DISLOTWIN_ID
where(plastic_disloTungsten_init()) phase_plasticity = PLASTICITY_DISLOTUNGSTEN_ID
where(plastic_nonlocal_init()) phase_plasticity = PLASTICITY_NONLOCAL_ID
do p = 1, phases%length
phase_plasticityInstance(p) = count(phase_plasticity(1:p) == phase_plasticity(p))
enddo
end subroutine plastic_init end subroutine plastic_init
!--------------------------------------------------------------------------------------------------
!> @brief checks if a plastic module is active or not
!--------------------------------------------------------------------------------------------------
module function plastic_active(plastic_label) result(active_plastic)
character(len=*), intent(in) :: plastic_label !< type of plasticity model
logical, dimension(:), allocatable :: active_plastic
class(tNode), pointer :: &
phases, &
phase, &
pl
integer :: p
phases => material_root%get('phase')
allocate(active_plastic(phases%length), source = .false. )
do p = 1, phases%length
phase => phases%get(p)
pl => phase%get('plasticity')
if(pl%get_asString('type') == plastic_label) active_plastic(p) = .true.
enddo
end function plastic_active
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
!> @brief calls microstructure function of the different plasticity constitutive models !> @brief calls microstructure function of the different plasticity constitutive models
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
@ -222,8 +272,8 @@ module subroutine constitutive_plastic_dependentState(F, Fp, ipc, ip, el)
plasticityType: select case (phase_plasticity(material_phaseAt(ipc,el))) plasticityType: select case (phase_plasticity(material_phaseAt(ipc,el)))
case (PLASTICITY_DISLOTWIN_ID) plasticityType case (PLASTICITY_DISLOTWIN_ID) plasticityType
call plastic_dislotwin_dependentState(temperature(ho)%p(tme),instance,of) call plastic_dislotwin_dependentState(temperature(ho)%p(tme),instance,of)
case (PLASTICITY_DISLOUCLA_ID) plasticityType case (PLASTICITY_DISLOTUNGSTEN_ID) plasticityType
call plastic_disloUCLA_dependentState(instance,of) call plastic_disloTungsten_dependentState(instance,of)
case (PLASTICITY_NONLOCAL_ID) plasticityType case (PLASTICITY_NONLOCAL_ID) plasticityType
call plastic_nonlocal_dependentState (F,Fp,instance,of,ip,el) call plastic_nonlocal_dependentState (F,Fp,instance,of,ip,el)
end select plasticityType end select plasticityType
@ -275,7 +325,7 @@ module subroutine constitutive_plastic_LpAndItsTangents(Lp, dLp_dS, dLp_dFi, &
dLp_dMp = 0.0_pReal dLp_dMp = 0.0_pReal
case (PLASTICITY_ISOTROPIC_ID) plasticityType case (PLASTICITY_ISOTROPIC_ID) plasticityType
call plastic_isotropic_LpAndItsTangent (Lp,dLp_dMp,Mp,instance,of) call plastic_isotropic_LpAndItsTangent(Lp,dLp_dMp,Mp,instance,of)
case (PLASTICITY_PHENOPOWERLAW_ID) plasticityType case (PLASTICITY_PHENOPOWERLAW_ID) plasticityType
call plastic_phenopowerlaw_LpAndItsTangent(Lp,dLp_dMp,Mp,instance,of) call plastic_phenopowerlaw_LpAndItsTangent(Lp,dLp_dMp,Mp,instance,of)
@ -284,13 +334,13 @@ module subroutine constitutive_plastic_LpAndItsTangents(Lp, dLp_dS, dLp_dFi, &
call plastic_kinehardening_LpAndItsTangent(Lp,dLp_dMp,Mp,instance,of) call plastic_kinehardening_LpAndItsTangent(Lp,dLp_dMp,Mp,instance,of)
case (PLASTICITY_NONLOCAL_ID) plasticityType case (PLASTICITY_NONLOCAL_ID) plasticityType
call plastic_nonlocal_LpAndItsTangent (Lp,dLp_dMp,Mp, temperature(ho)%p(tme),instance,of,ip,el) call plastic_nonlocal_LpAndItsTangent(Lp,dLp_dMp,Mp, temperature(ho)%p(tme),instance,of,ip,el)
case (PLASTICITY_DISLOTWIN_ID) plasticityType case (PLASTICITY_DISLOTWIN_ID) plasticityType
call plastic_dislotwin_LpAndItsTangent (Lp,dLp_dMp,Mp,temperature(ho)%p(tme),instance,of) call plastic_dislotwin_LpAndItsTangent(Lp,dLp_dMp,Mp,temperature(ho)%p(tme),instance,of)
case (PLASTICITY_DISLOUCLA_ID) plasticityType case (PLASTICITY_DISLOTUNGSTEN_ID) plasticityType
call plastic_disloucla_LpAndItsTangent (Lp,dLp_dMp,Mp,temperature(ho)%p(tme),instance,of) call plastic_disloTungsten_LpAndItsTangent(Lp,dLp_dMp,Mp,temperature(ho)%p(tme),instance,of)
end select plasticityType end select plasticityType
@ -311,8 +361,8 @@ module subroutine plastic_results
integer :: p integer :: p
character(len=pStringLen) :: group character(len=pStringLen) :: group
plasticityLoop: do p=1,size(config_name_phase) plasticityLoop: do p=1,size(material_name_phase)
group = trim('current/constituent')//'/'//trim(config_name_phase(p)) group = trim('current/constituent')//'/'//trim(material_name_phase(p))
call results_closeGroup(results_addGroup(group)) call results_closeGroup(results_addGroup(group))
group = trim(group)//'/plastic' group = trim(group)//'/plastic'
@ -332,8 +382,8 @@ module subroutine plastic_results
case(PLASTICITY_DISLOTWIN_ID) case(PLASTICITY_DISLOTWIN_ID)
call plastic_dislotwin_results(phase_plasticityInstance(p),group) call plastic_dislotwin_results(phase_plasticityInstance(p),group)
case(PLASTICITY_DISLOUCLA_ID) case(PLASTICITY_DISLOTUNGSTEN_ID)
call plastic_disloUCLA_results(phase_plasticityInstance(p),group) call plastic_disloTungsten_results(phase_plasticityInstance(p),group)
case(PLASTICITY_NONLOCAL_ID) case(PLASTICITY_NONLOCAL_ID)
call plastic_nonlocal_results(phase_plasticityInstance(p),group) call plastic_nonlocal_results(phase_plasticityInstance(p),group)

View File

@ -5,7 +5,7 @@
!> @author Martin Diehl, Max-Planck-Institut für Eisenforschung GmbH !> @author Martin Diehl, Max-Planck-Institut für Eisenforschung GmbH
!> @brief crystal plasticity model for bcc metals, especially Tungsten !> @brief crystal plasticity model for bcc metals, especially Tungsten
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
submodule(constitutive:constitutive_plastic) plastic_disloUCLA submodule(constitutive:constitutive_plastic) plastic_disloTungsten
real(pReal), parameter :: & real(pReal), parameter :: &
kB = 1.38e-23_pReal !< Boltzmann constant in J/Kelvin kB = 1.38e-23_pReal !< Boltzmann constant in J/Kelvin
@ -20,8 +20,8 @@ submodule(constitutive:constitutive_plastic) plastic_disloUCLA
b_sl, & !< magnitude of burgers vector [m] b_sl, & !< magnitude of burgers vector [m]
D_a, & D_a, &
i_sl, & !< Adj. parameter for distance between 2 forest dislocations i_sl, & !< Adj. parameter for distance between 2 forest dislocations
atomicVolume, & atomicVolume, & !< factor to calculate atomic volume
tau_0, & tau_0, & !< Peierls stress
!* mobility law parameters !* mobility law parameters
delta_F, & !< activation energy for glide [J] delta_F, & !< activation energy for glide [J]
v0, & !< dislocation velocity prefactor [m/s] v0, & !< dislocation velocity prefactor [m/s]
@ -46,26 +46,26 @@ submodule(constitutive:constitutive_plastic) plastic_disloUCLA
dipoleFormation !< flag indicating consideration of dipole formation dipoleFormation !< flag indicating consideration of dipole formation
end type !< container type for internal constitutive parameters end type !< container type for internal constitutive parameters
type :: tDisloUCLAState type :: tDisloTungstenState
real(pReal), dimension(:,:), pointer :: & real(pReal), dimension(:,:), pointer :: &
rho_mob, & rho_mob, &
rho_dip, & rho_dip, &
gamma_sl gamma_sl
end type tDisloUCLAState end type tDisloTungstenState
type :: tDisloUCLAdependentState type :: tDisloTungstendependentState
real(pReal), dimension(:,:), allocatable :: & real(pReal), dimension(:,:), allocatable :: &
Lambda_sl, & Lambda_sl, &
threshold_stress threshold_stress
end type tDisloUCLAdependentState end type tDisloTungstendependentState
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! containers for parameters and state ! containers for parameters and state
type(tParameters), allocatable, dimension(:) :: param type(tParameters), allocatable, dimension(:) :: param
type(tDisloUCLAState), allocatable, dimension(:) :: & type(tDisloTungstenState), allocatable, dimension(:) :: &
dotState, & dotState, &
state state
type(tDisloUCLAdependentState), allocatable, dimension(:) :: dependentState type(tDisloTungstendependentState), allocatable, dimension(:) :: dependentState
contains contains
@ -74,8 +74,9 @@ contains
!> @brief Perform module initialization. !> @brief Perform module initialization.
!> @details reads in material parameters, allocates arrays, and does sanity checks !> @details reads in material parameters, allocates arrays, and does sanity checks
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
module subroutine plastic_disloUCLA_init module function plastic_disloTungsten_init() result(myPlasticity)
logical, dimension(:), allocatable :: myPlasticity
integer :: & integer :: &
Ninstance, & Ninstance, &
p, i, & p, i, &
@ -90,43 +91,59 @@ module subroutine plastic_disloUCLA_init
a !< non-Schmid coefficients a !< non-Schmid coefficients
character(len=pStringLen) :: & character(len=pStringLen) :: &
extmsg = '' extmsg = ''
class(tNode), pointer :: &
phases, &
phase, &
pl
write(6,'(/,a)') ' <<<+- plastic_'//PLASTICITY_DISLOUCLA_LABEL//' init -+>>>' write(6,'(/,a)') ' <<<+- plastic_disloTungsten init -+>>>'
write(6,'(/,a)') ' Cereceda et al., International Journal of Plasticity 78:242256, 2016' write(6,'(/,a)') ' Cereceda et al., International Journal of Plasticity 78:242256, 2016'
write(6,'(a)') ' https://dx.doi.org/10.1016/j.ijplas.2015.09.002' write(6,'(a)') ' https://dx.doi.org/10.1016/j.ijplas.2015.09.002'
Ninstance = count(phase_plasticity == PLASTICITY_DISLOUCLA_ID) myPlasticity = plastic_active('disloTungsten')
Ninstance = count(myPlasticity)
write(6,'(a16,1x,i5,/)') '# instances:',Ninstance; flush(6) write(6,'(a16,1x,i5,/)') '# instances:',Ninstance; flush(6)
if(Ninstance == 0) return
allocate(param(Ninstance)) allocate(param(Ninstance))
allocate(state(Ninstance)) allocate(state(Ninstance))
allocate(dotState(Ninstance)) allocate(dotState(Ninstance))
allocate(dependentState(Ninstance)) allocate(dependentState(Ninstance))
do p = 1, size(phase_plasticity) phases => material_root%get('phase')
if (phase_plasticity(p) /= PLASTICITY_DISLOUCLA_ID) cycle i = 0
associate(prm => param(phase_plasticityInstance(p)), & do p = 1, phases%length
dot => dotState(phase_plasticityInstance(p)), & phase => phases%get(p)
stt => state(phase_plasticityInstance(p)), &
dst => dependentState(phase_plasticityInstance(p)), &
config => config_phase(p))
prm%output = config%getStrings('(output)',defaultVal=emptyStringArray) if(.not. myPlasticity(p)) cycle
i = i + 1
associate(prm => param(i), &
dot => dotState(i), &
stt => state(i), &
dst => dependentState(i))
pl => phase%get('plasticity')
#if defined (__GFORTRAN__)
prm%output = output_asStrings(pl)
#else
prm%output = pl%get_asStrings('output',defaultVal=emptyStringArray)
#endif
! This data is read in already in lattice ! This data is read in already in lattice
prm%mu = lattice_mu(p) prm%mu = lattice_mu(p)
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! slip related parameters ! slip related parameters
N_sl = config%getInts('nslip',defaultVal=emptyIntArray) N_sl = pl%get_asInts('N_sl',defaultVal=emptyIntArray)
prm%sum_N_sl = sum(abs(N_sl)) prm%sum_N_sl = sum(abs(N_sl))
slipActive: if (prm%sum_N_sl > 0) then slipActive: if (prm%sum_N_sl > 0) then
prm%P_sl = lattice_SchmidMatrix_slip(N_sl,config%getString('lattice_structure'),& prm%P_sl = lattice_SchmidMatrix_slip(N_sl,phase%get_asString('lattice'),&
config%getFloat('c/a',defaultVal=0.0_pReal)) phase%get_asFloat('c/a',defaultVal=0.0_pReal))
if(trim(config%getString('lattice_structure')) == 'bcc') then if(trim(phase%get_asString('lattice')) == 'bcc') then
a = config%getFloats('nonschmid_coefficients',defaultVal = emptyRealArray) a = pl%get_asFloats('nonSchmid_coefficients',defaultVal = emptyRealArray)
prm%nonSchmid_pos = lattice_nonSchmidMatrix(N_sl,a,+1) prm%nonSchmid_pos = lattice_nonSchmidMatrix(N_sl,a,+1)
prm%nonSchmid_neg = lattice_nonSchmidMatrix(N_sl,a,-1) prm%nonSchmid_neg = lattice_nonSchmidMatrix(N_sl,a,-1)
else else
@ -134,35 +151,36 @@ module subroutine plastic_disloUCLA_init
prm%nonSchmid_neg = prm%P_sl prm%nonSchmid_neg = prm%P_sl
endif endif
prm%h_sl_sl = lattice_interaction_SlipBySlip(N_sl,config%getFloats('interaction_slipslip'), & prm%h_sl_sl = lattice_interaction_SlipBySlip(N_sl,pl%get_asFloats('h_sl_sl'), &
config%getString('lattice_structure')) phase%get_asString('lattice'))
prm%forestProjection = lattice_forestProjection_edge(N_sl,config%getString('lattice_structure'),& prm%forestProjection = lattice_forestProjection_edge(N_sl,phase%get_asString('lattice'),&
config%getFloat('c/a',defaultVal=0.0_pReal)) phase%get_asFloat('c/a',defaultVal=0.0_pReal))
prm%forestProjection = transpose(prm%forestProjection) prm%forestProjection = transpose(prm%forestProjection)
rho_mob_0 = config%getFloats('rhoedge0', requiredSize=size(N_sl)) rho_mob_0 = pl%get_asFloats('rho_mob_0', requiredSize=size(N_sl))
rho_dip_0 = config%getFloats('rhoedgedip0', requiredSize=size(N_sl)) rho_dip_0 = pl%get_asFloats('rho_dip_0', requiredSize=size(N_sl))
prm%v0 = config%getFloats('v0', requiredSize=size(N_sl)) prm%v0 = pl%get_asFloats('v_0', requiredSize=size(N_sl))
prm%b_sl = config%getFloats('slipburgers', requiredSize=size(N_sl)) prm%b_sl = pl%get_asFloats('b_sl', requiredSize=size(N_sl))
prm%delta_F = config%getFloats('qedge', requiredSize=size(N_sl)) prm%delta_F = pl%get_asFloats('Q_s', requiredSize=size(N_sl))
prm%i_sl = config%getFloats('clambdaslip', requiredSize=size(N_sl)) prm%i_sl = pl%get_asFloats('i_sl', requiredSize=size(N_sl))
prm%tau_0 = config%getFloats('tau_peierls', requiredSize=size(N_sl)) prm%tau_0 = pl%get_asFloats('tau_peierls', requiredSize=size(N_sl))
prm%p = config%getFloats('p_slip', requiredSize=size(N_sl), & prm%p = pl%get_asFloats('p_sl', requiredSize=size(N_sl), &
defaultVal=[(1.0_pReal,i=1,size(N_sl))]) defaultVal=[(1.0_pReal,i=1,size(N_sl))])
prm%q = config%getFloats('q_slip', requiredSize=size(N_sl), & prm%q = pl%get_asFloats('q_sl', requiredSize=size(N_sl), &
defaultVal=[(1.0_pReal,i=1,size(N_sl))]) defaultVal=[(1.0_pReal,i=1,size(N_sl))])
prm%kink_height = config%getFloats('kink_height', requiredSize=size(N_sl)) prm%kink_height = pl%get_asFloats('h', requiredSize=size(N_sl))
prm%w = config%getFloats('kink_width', requiredSize=size(N_sl)) prm%w = pl%get_asFloats('w', requiredSize=size(N_sl))
prm%omega = config%getFloats('omega', requiredSize=size(N_sl)) prm%omega = pl%get_asFloats('omega', requiredSize=size(N_sl))
prm%B = config%getFloats('friction_coeff', requiredSize=size(N_sl)) prm%B = pl%get_asFloats('B', requiredSize=size(N_sl))
prm%D = config%getFloat('grainsize') prm%D = pl%get_asFloat('D')
prm%D_0 = config%getFloat('d0') prm%D_0 = pl%get_asFloat('D_0')
prm%Q_cl = config%getFloat('qsd') prm%Q_cl = pl%get_asFloat('Q_cl')
prm%atomicVolume = config%getFloat('catomicvolume') * prm%b_sl**3.0_pReal prm%atomicVolume = pl%get_asFloat('f_at') * prm%b_sl**3.0_pReal
prm%D_a = config%getFloat('cedgedipmindistance') * prm%b_sl prm%D_a = pl%get_asFloat('D_a') * prm%b_sl
prm%dipoleformation = config%getFloat('dipoleformationfactor') > 0.0_pReal !should be on by default, ToDo: change to /key/-type key
prm%dipoleformation = pl%get_asBool('dipole_formation_factor', defaultVal = .true.)
! expand: family => system ! expand: family => system
rho_mob_0 = math_expand(rho_mob_0, N_sl) rho_mob_0 = math_expand(rho_mob_0, N_sl)
@ -184,14 +202,14 @@ module subroutine plastic_disloUCLA_init
! sanity checks ! sanity checks
if ( prm%D_0 <= 0.0_pReal) extmsg = trim(extmsg)//' D_0' if ( prm%D_0 <= 0.0_pReal) extmsg = trim(extmsg)//' D_0'
if ( prm%Q_cl <= 0.0_pReal) extmsg = trim(extmsg)//' Q_cl' if ( prm%Q_cl <= 0.0_pReal) extmsg = trim(extmsg)//' Q_cl'
if (any(rho_mob_0 < 0.0_pReal)) extmsg = trim(extmsg)//' rhoedge0' if (any(rho_mob_0 < 0.0_pReal)) extmsg = trim(extmsg)//' rho_mob_0'
if (any(rho_dip_0 < 0.0_pReal)) extmsg = trim(extmsg)//' rhoedgedip0' if (any(rho_dip_0 < 0.0_pReal)) extmsg = trim(extmsg)//' rho_dip_0'
if (any(prm%v0 < 0.0_pReal)) extmsg = trim(extmsg)//' v0' if (any(prm%v0 < 0.0_pReal)) extmsg = trim(extmsg)//' v_0'
if (any(prm%b_sl <= 0.0_pReal)) extmsg = trim(extmsg)//' b_sl' if (any(prm%b_sl <= 0.0_pReal)) extmsg = trim(extmsg)//' b_sl'
if (any(prm%delta_F <= 0.0_pReal)) extmsg = trim(extmsg)//' qedge' if (any(prm%delta_F <= 0.0_pReal)) extmsg = trim(extmsg)//' Q_s'
if (any(prm%tau_0 < 0.0_pReal)) extmsg = trim(extmsg)//' tau_0' if (any(prm%tau_0 < 0.0_pReal)) extmsg = trim(extmsg)//' tau_peierls'
if (any(prm%D_a <= 0.0_pReal)) extmsg = trim(extmsg)//' cedgedipmindistance or b_sl' if (any(prm%D_a <= 0.0_pReal)) extmsg = trim(extmsg)//' D_a or b_sl'
if (any(prm%atomicVolume <= 0.0_pReal)) extmsg = trim(extmsg)//' catomicvolume or b_sl' if (any(prm%atomicVolume <= 0.0_pReal)) extmsg = trim(extmsg)//' f_at or b_sl'
else slipActive else slipActive
rho_mob_0= emptyRealArray; rho_dip_0 = emptyRealArray rho_mob_0= emptyRealArray; rho_dip_0 = emptyRealArray
@ -208,7 +226,7 @@ module subroutine plastic_disloUCLA_init
sizeDotState = size(['rho_mob ','rho_dip ','gamma_sl']) * prm%sum_N_sl sizeDotState = size(['rho_mob ','rho_dip ','gamma_sl']) * prm%sum_N_sl
sizeState = sizeDotState sizeState = sizeDotState
call material_allocateState(plasticState(p),NipcMyPhase,sizeState,sizeDotState,0) call constitutive_allocateState(plasticState(p),NipcMyPhase,sizeState,sizeDotState,0)
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! state aliases and initialization ! state aliases and initialization
@ -217,7 +235,7 @@ module subroutine plastic_disloUCLA_init
stt%rho_mob => plasticState(p)%state(startIndex:endIndex,:) stt%rho_mob => plasticState(p)%state(startIndex:endIndex,:)
stt%rho_mob = spread(rho_mob_0,2,NipcMyPhase) stt%rho_mob = spread(rho_mob_0,2,NipcMyPhase)
dot%rho_mob => plasticState(p)%dotState(startIndex:endIndex,:) dot%rho_mob => plasticState(p)%dotState(startIndex:endIndex,:)
plasticState(p)%atol(startIndex:endIndex) = config%getFloat('atol_rho',defaultVal=1.0_pReal) plasticState(p)%atol(startIndex:endIndex) = pl%get_asFloat('atol_rho',defaultVal=1.0_pReal)
if (any(plasticState(p)%atol(startIndex:endIndex) < 0.0_pReal)) extmsg = trim(extmsg)//' atol_rho' if (any(plasticState(p)%atol(startIndex:endIndex) < 0.0_pReal)) extmsg = trim(extmsg)//' atol_rho'
startIndex = endIndex + 1 startIndex = endIndex + 1
@ -225,7 +243,7 @@ module subroutine plastic_disloUCLA_init
stt%rho_dip => plasticState(p)%state(startIndex:endIndex,:) stt%rho_dip => plasticState(p)%state(startIndex:endIndex,:)
stt%rho_dip = spread(rho_dip_0,2,NipcMyPhase) stt%rho_dip = spread(rho_dip_0,2,NipcMyPhase)
dot%rho_dip => plasticState(p)%dotState(startIndex:endIndex,:) dot%rho_dip => plasticState(p)%dotState(startIndex:endIndex,:)
plasticState(p)%atol(startIndex:endIndex) = config%getFloat('atol_rho',defaultVal=1.0_pReal) plasticState(p)%atol(startIndex:endIndex) = pl%get_asFloat('atol_rho',defaultVal=1.0_pReal)
startIndex = endIndex + 1 startIndex = endIndex + 1
endIndex = endIndex + prm%sum_N_sl endIndex = endIndex + prm%sum_N_sl
@ -244,17 +262,17 @@ module subroutine plastic_disloUCLA_init
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! exit if any parameter is out of range ! exit if any parameter is out of range
if (extmsg /= '') call IO_error(211,ext_msg=trim(extmsg)//'('//PLASTICITY_DISLOUCLA_LABEL//')') if (extmsg /= '') call IO_error(211,ext_msg=trim(extmsg)//'(disloTungsten)')
enddo enddo
end subroutine plastic_disloUCLA_init end function plastic_disloTungsten_init
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
!> @brief Calculate plastic velocity gradient and its tangent. !> @brief Calculate plastic velocity gradient and its tangent.
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
pure module subroutine plastic_disloUCLA_LpAndItsTangent(Lp,dLp_dMp, & pure module subroutine plastic_disloTungsten_LpAndItsTangent(Lp,dLp_dMp, &
Mp,T,instance,of) Mp,T,instance,of)
real(pReal), dimension(3,3), intent(out) :: & real(pReal), dimension(3,3), intent(out) :: &
Lp !< plastic velocity gradient Lp !< plastic velocity gradient
@ -291,13 +309,13 @@ pure module subroutine plastic_disloUCLA_LpAndItsTangent(Lp,dLp_dMp, &
end associate end associate
end subroutine plastic_disloUCLA_LpAndItsTangent end subroutine plastic_disloTungsten_LpAndItsTangent
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
!> @brief Calculate the rate of change of microstructure. !> @brief Calculate the rate of change of microstructure.
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
module subroutine plastic_disloUCLA_dotState(Mp,T,instance,of) module subroutine plastic_disloTungsten_dotState(Mp,T,instance,of)
real(pReal), dimension(3,3), intent(in) :: & real(pReal), dimension(3,3), intent(in) :: &
Mp !< Mandel stress Mp !< Mandel stress
@ -351,13 +369,13 @@ module subroutine plastic_disloUCLA_dotState(Mp,T,instance,of)
end associate end associate
end subroutine plastic_disloUCLA_dotState end subroutine plastic_disloTungsten_dotState
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
!> @brief Calculate derived quantities from state. !> @brief Calculate derived quantities from state.
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
module subroutine plastic_disloUCLA_dependentState(instance,of) module subroutine plastic_disloTungsten_dependentState(instance,of)
integer, intent(in) :: & integer, intent(in) :: &
instance, & instance, &
@ -376,13 +394,13 @@ module subroutine plastic_disloUCLA_dependentState(instance,of)
end associate end associate
end subroutine plastic_disloUCLA_dependentState end subroutine plastic_disloTungsten_dependentState
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
!> @brief Write results to HDF5 output file. !> @brief Write results to HDF5 output file.
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
module subroutine plastic_disloUCLA_results(instance,group) module subroutine plastic_disloTungsten_results(instance,group)
integer, intent(in) :: instance integer, intent(in) :: instance
character(len=*), intent(in) :: group character(len=*), intent(in) :: group
@ -392,26 +410,26 @@ module subroutine plastic_disloUCLA_results(instance,group)
associate(prm => param(instance), stt => state(instance), dst => dependentState(instance)) associate(prm => param(instance), stt => state(instance), dst => dependentState(instance))
outputsLoop: do o = 1,size(prm%output) outputsLoop: do o = 1,size(prm%output)
select case(trim(prm%output(o))) select case(trim(prm%output(o)))
case('edge_density') ! ToDo: should be rho_mob case('rho_mob')
if(prm%sum_N_sl>0) call results_writeDataset(group,stt%rho_mob,'rho_mob',& if(prm%sum_N_sl>0) call results_writeDataset(group,stt%rho_mob,trim(prm%output(o)), &
'mobile dislocation density','1/m²') 'mobile dislocation density','1/m²')
case('dipole_density') ! ToDo: should be rho_dip case('rho_dip')
if(prm%sum_N_sl>0) call results_writeDataset(group,stt%rho_dip,'rho_dip',& if(prm%sum_N_sl>0) call results_writeDataset(group,stt%rho_dip,trim(prm%output(o)), &
'dislocation dipole density''1/m²') 'dislocation dipole density''1/m²')
case('shear_rate_slip') ! should be gamma case('gamma_sl')
if(prm%sum_N_sl>0) call results_writeDataset(group,stt%gamma_sl,'dot_gamma_sl',& ! this is not dot!! if(prm%sum_N_sl>0) call results_writeDataset(group,stt%gamma_sl,trim(prm%output(o)), &
'plastic shear','1') 'plastic shear','1')
case('mfp_slip') !ToDo: should be Lambda case('Lambda_sl')
if(prm%sum_N_sl>0) call results_writeDataset(group,dst%Lambda_sl,'Lambda_sl',& if(prm%sum_N_sl>0) call results_writeDataset(group,dst%Lambda_sl,trim(prm%output(o)), &
'mean free path for slip','m') 'mean free path for slip','m')
case('threshold_stress_slip') !ToDo: should be tau_pass case('tau_pass')
if(prm%sum_N_sl>0) call results_writeDataset(group,dst%threshold_stress,'tau_pass',& if(prm%sum_N_sl>0) call results_writeDataset(group,dst%threshold_stress,trim(prm%output(o)), &
'threshold stress for slip','Pa') 'threshold stress for slip','Pa')
end select end select
enddo outputsLoop enddo outputsLoop
end associate end associate
end subroutine plastic_disloUCLA_results end subroutine plastic_disloTungsten_results
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
@ -529,4 +547,4 @@ pure subroutine kinetics(Mp,T,instance,of, &
end subroutine kinetics end subroutine kinetics
end submodule plastic_disloUCLA end submodule plastic_disloTungsten

View File

@ -22,8 +22,8 @@ submodule(constitutive:constitutive_plastic) plastic_dislotwin
D = 1.0_pReal, & !< grain size D = 1.0_pReal, & !< grain size
p_sb = 1.0_pReal, & !< p-exponent in shear band velocity p_sb = 1.0_pReal, & !< p-exponent in shear band velocity
q_sb = 1.0_pReal, & !< q-exponent in shear band velocity q_sb = 1.0_pReal, & !< q-exponent in shear band velocity
CEdgeDipMinDistance = 1.0_pReal, & !< CEdgeDipMinDistance = 1.0_pReal, & !< adjustment parameter to calculate minimum dipole distance
i_tw = 1.0_pReal, & !< i_tw = 1.0_pReal, & !< adjustment parameter to calculate MFP for twinning
tau_0 = 1.0_pReal, & !< strength due to elements in solid solution tau_0 = 1.0_pReal, & !< strength due to elements in solid solution
L_tw = 1.0_pReal, & !< Length of twin nuclei in Burgers vectors L_tw = 1.0_pReal, & !< Length of twin nuclei in Burgers vectors
L_tr = 1.0_pReal, & !< Length of trans nuclei in Burgers vectors L_tr = 1.0_pReal, & !< Length of trans nuclei in Burgers vectors
@ -36,7 +36,7 @@ submodule(constitutive:constitutive_plastic) plastic_dislotwin
SFE_0K = 1.0_pReal, & !< stacking fault energy at zero K SFE_0K = 1.0_pReal, & !< stacking fault energy at zero K
dSFE_dT = 1.0_pReal, & !< temperature dependence of stacking fault energy dSFE_dT = 1.0_pReal, & !< temperature dependence of stacking fault energy
gamma_fcc_hex = 1.0_pReal, & !< Free energy difference between austensite and martensite gamma_fcc_hex = 1.0_pReal, & !< Free energy difference between austensite and martensite
i_tr = 1.0_pReal, & !< i_tr = 1.0_pReal, & !< adjustment parameter to calculate MFP for transformation
h = 1.0_pReal !< Stack height of hex nucleus h = 1.0_pReal !< Stack height of hex nucleus
real(pReal), allocatable, dimension(:) :: & real(pReal), allocatable, dimension(:) :: &
b_sl, & !< absolute length of burgers vector [m] for each slip system b_sl, & !< absolute length of burgers vector [m] for each slip system
@ -56,11 +56,11 @@ submodule(constitutive:constitutive_plastic) plastic_dislotwin
gamma_char, & !< characteristic shear for twins gamma_char, & !< characteristic shear for twins
B !< drag coefficient B !< drag coefficient
real(pReal), allocatable, dimension(:,:) :: & real(pReal), allocatable, dimension(:,:) :: &
h_sl_sl, & !< h_sl_sl, & !< components of slip-slip interaction matrix
h_sl_tw, & !< h_sl_tw, & !< components of slip-twin interaction matrix
h_tw_tw, & !< h_tw_tw, & !< components of twin-twin interaction matrix
h_sl_tr, & !< h_sl_tr, & !< components of slip-trans interaction matrix
h_tr_tr, & !< h_tr_tr, & !< components of trans-trans interaction matrix
n0_sl, & !< slip system normal n0_sl, & !< slip system normal
forestProjection, & forestProjection, &
C66 C66
@ -98,9 +98,9 @@ submodule(constitutive:constitutive_plastic) plastic_dislotwin
Lambda_sl, & !< mean free path between 2 obstacles seen by a moving dislocation Lambda_sl, & !< mean free path between 2 obstacles seen by a moving dislocation
Lambda_tw, & !< mean free path between 2 obstacles seen by a growing twin Lambda_tw, & !< mean free path between 2 obstacles seen by a growing twin
Lambda_tr, & !< mean free path between 2 obstacles seen by a growing martensite Lambda_tr, & !< mean free path between 2 obstacles seen by a growing martensite
tau_pass, & tau_pass, & !< threshold stress for slip
tau_hat_tw, & tau_hat_tw, & !< threshold stress for twinning
tau_hat_tr, & tau_hat_tr, & !< threshold stress for transformation
V_tw, & !< volume of a new twin V_tw, & !< volume of a new twin
V_tr, & !< volume of a new martensite disc V_tr, & !< volume of a new martensite disc
tau_r_tw, & !< stress to bring partials close together (twin) tau_r_tw, & !< stress to bring partials close together (twin)
@ -122,8 +122,9 @@ contains
!> @brief Perform module initialization. !> @brief Perform module initialization.
!> @details reads in material parameters, allocates arrays, and does sanity checks !> @details reads in material parameters, allocates arrays, and does sanity checks
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
module subroutine plastic_dislotwin_init module function plastic_dislotwin_init() result(myPlasticity)
logical, dimension(:), allocatable :: myPlasticity
integer :: & integer :: &
Ninstance, & Ninstance, &
p, i, & p, i, &
@ -137,8 +138,12 @@ module subroutine plastic_dislotwin_init
rho_dip_0 !< initial dipole dislocation density per slip system rho_dip_0 !< initial dipole dislocation density per slip system
character(len=pStringLen) :: & character(len=pStringLen) :: &
extmsg = '' extmsg = ''
class(tNode), pointer :: &
phases, &
phase, &
pl
write(6,'(/,a)') ' <<<+- constitutive_'//PLASTICITY_DISLOTWIN_LABEL//' init -+>>>' write(6,'(/,a)') ' <<<+- constitutive_dislotwin init -+>>>'
write(6,'(/,a)') ' Ma and Roters, Acta Materialia 52(12):36033612, 2004' write(6,'(/,a)') ' Ma and Roters, Acta Materialia 52(12):36033612, 2004'
write(6,'(a)') ' https://doi.org/10.1016/j.actamat.2004.04.012' write(6,'(a)') ' https://doi.org/10.1016/j.actamat.2004.04.012'
@ -149,23 +154,35 @@ module subroutine plastic_dislotwin_init
write(6,'(/,a)') ' Wong et al., Acta Materialia 118:140151, 2016' write(6,'(/,a)') ' Wong et al., Acta Materialia 118:140151, 2016'
write(6,'(a,/)') ' https://doi.org/10.1016/j.actamat.2016.07.032' write(6,'(a,/)') ' https://doi.org/10.1016/j.actamat.2016.07.032'
Ninstance = count(phase_plasticity == PLASTICITY_DISLOTWIN_ID) myPlasticity = plastic_active('dislotwin')
Ninstance = count(myPlasticity)
write(6,'(a16,1x,i5,/)') '# instances:',Ninstance; flush(6) write(6,'(a16,1x,i5,/)') '# instances:',Ninstance; flush(6)
if(Ninstance == 0) return
allocate(param(Ninstance)) allocate(param(Ninstance))
allocate(state(Ninstance)) allocate(state(Ninstance))
allocate(dotState(Ninstance)) allocate(dotState(Ninstance))
allocate(dependentState(Ninstance)) allocate(dependentState(Ninstance))
do p = 1, size(phase_plasticity) phases => material_root%get('phase')
if (phase_plasticity(p) /= PLASTICITY_DISLOTWIN_ID) cycle i = 0
associate(prm => param(phase_plasticityInstance(p)), & do p = 1, phases%length
dot => dotState(phase_plasticityInstance(p)), & phase => phases%get(p)
stt => state(phase_plasticityInstance(p)), &
dst => dependentState(phase_plasticityInstance(p)), &
config => config_phase(p))
prm%output = config%getStrings('(output)', defaultVal=emptyStringArray) if(.not. myPlasticity(p)) cycle
i = i + 1
associate(prm => param(i), &
dot => dotState(i), &
stt => state(i), &
dst => dependentState(i))
pl => phase%get('plasticity')
#if defined (__GFORTRAN__)
prm%output = output_asStrings(pl)
#else
prm%output = pl%get_asStrings('output',defaultVal=emptyStringArray)
#endif
! This data is read in already in lattice ! This data is read in already in lattice
prm%mu = lattice_mu(p) prm%mu = lattice_mu(p)
@ -174,49 +191,49 @@ module subroutine plastic_dislotwin_init
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! slip related parameters ! slip related parameters
N_sl = config%getInts('nslip',defaultVal=emptyIntArray) N_sl = pl%get_asInts('N_sl',defaultVal=emptyIntArray)
prm%sum_N_sl = sum(abs(N_sl)) prm%sum_N_sl = sum(abs(N_sl))
slipActive: if (prm%sum_N_sl > 0) then slipActive: if (prm%sum_N_sl > 0) then
prm%P_sl = lattice_SchmidMatrix_slip(N_sl,config%getString('lattice_structure'),& prm%P_sl = lattice_SchmidMatrix_slip(N_sl,phase%get_asString('lattice'),&
config%getFloat('c/a',defaultVal=0.0_pReal)) phase%get_asFloat('c/a',defaultVal=0.0_pReal))
prm%h_sl_sl = lattice_interaction_SlipBySlip(N_sl,config%getFloats('interaction_slipslip'), & prm%h_sl_sl = lattice_interaction_SlipBySlip(N_sl,pl%get_asFloats('h_sl_sl'), &
config%getString('lattice_structure')) phase%get_asString('lattice'))
prm%forestProjection = lattice_forestProjection_edge(N_sl,config%getString('lattice_structure'),& prm%forestProjection = lattice_forestProjection_edge(N_sl,phase%get_asString('lattice'),&
config%getFloat('c/a',defaultVal=0.0_pReal)) phase%get_asFloat('c/a',defaultVal=0.0_pReal))
prm%forestProjection = transpose(prm%forestProjection) prm%forestProjection = transpose(prm%forestProjection)
prm%n0_sl = lattice_slip_normal(N_sl,config%getString('lattice_structure'),& prm%n0_sl = lattice_slip_normal(N_sl,phase%get_asString('lattice'),&
config%getFloat('c/a',defaultVal=0.0_pReal)) phase%get_asFloat('c/a',defaultVal=0.0_pReal))
prm%fccTwinTransNucleation = merge(.true., .false., lattice_structure(p) == lattice_FCC_ID) & prm%fccTwinTransNucleation = merge(.true., .false., lattice_structure(p) == lattice_FCC_ID) &
.and. (N_sl(1) == 12) .and. (N_sl(1) == 12)
if(prm%fccTwinTransNucleation) prm%fcc_twinNucleationSlipPair = lattice_FCC_TWINNUCLEATIONSLIPPAIR if(prm%fccTwinTransNucleation) prm%fcc_twinNucleationSlipPair = lattice_FCC_TWINNUCLEATIONSLIPPAIR
rho_mob_0 = config%getFloats('rhoedge0', requiredSize=size(N_sl)) rho_mob_0 = pl%get_asFloats('rho_mob_0', requiredSize=size(N_sl))
rho_dip_0 = config%getFloats('rhoedgedip0',requiredSize=size(N_sl)) rho_dip_0 = pl%get_asFloats('rho_dip_0', requiredSize=size(N_sl))
prm%v0 = config%getFloats('v0', requiredSize=size(N_sl)) prm%v0 = pl%get_asFloats('v_0', requiredSize=size(N_sl))
prm%b_sl = config%getFloats('slipburgers',requiredSize=size(N_sl)) prm%b_sl = pl%get_asFloats('b_sl', requiredSize=size(N_sl))
prm%Delta_F = config%getFloats('qedge', requiredSize=size(N_sl)) prm%Delta_F = pl%get_asFloats('Q_s', requiredSize=size(N_sl))
prm%CLambdaSlip = config%getFloats('clambdaslip',requiredSize=size(N_sl)) prm%CLambdaSlip = pl%get_asFloats('i_sl', requiredSize=size(N_sl))
prm%p = config%getFloats('p_slip', requiredSize=size(N_sl)) prm%p = pl%get_asFloats('p_sl', requiredSize=size(N_sl))
prm%q = config%getFloats('q_slip', requiredSize=size(N_sl)) prm%q = pl%get_asFloats('q_sl', requiredSize=size(N_sl))
prm%B = config%getFloats('b', requiredSize=size(N_sl), & prm%B = pl%get_asFloats('B', requiredSize=size(N_sl), &
defaultVal=[(0.0_pReal, i=1,size(N_sl))]) defaultVal=[(0.0_pReal, i=1,size(N_sl))])
prm%tau_0 = config%getFloat('solidsolutionstrength') prm%tau_0 = pl%get_asFloat('tau_0')
prm%CEdgeDipMinDistance = config%getFloat('cedgedipmindistance') prm%CEdgeDipMinDistance = pl%get_asFloat('D_a')
prm%D0 = config%getFloat('d0') prm%D0 = pl%get_asFloat('D_0')
prm%Qsd = config%getFloat('qsd') prm%Qsd = pl%get_asFloat('Q_cl')
prm%ExtendedDislocations = config%keyExists('/extend_dislocations/') prm%ExtendedDislocations = pl%get_asBool('extend_dislocations',defaultVal = .false.)
if (prm%ExtendedDislocations) then if (prm%ExtendedDislocations) then
prm%SFE_0K = config%getFloat('sfe_0k') prm%SFE_0K = pl%get_asFloat('Gamma_sf_0K')
prm%dSFE_dT = config%getFloat('dsfe_dt') prm%dSFE_dT = pl%get_asFloat('dGamma_sf_dT')
endif endif
prm%dipoleformation = .not. config%keyExists('/nodipoleformation/') prm%dipoleformation = .not. pl%get_asBool('no_dipole_formation',defaultVal = .false.)
! multiplication factor according to crystal structure (nearest neighbors bcc vs fcc/hex) ! multiplication factor according to crystal structure (nearest neighbors bcc vs fcc/hex)
! details: Argon & Moffat, Acta Metallurgica, Vol. 29, pg 293 to 299, 1981 ! details: Argon & Moffat, Acta Metallurgica, Vol. 29, pg 293 to 299, 1981
prm%omega = config%getFloat('omega', defaultVal = 1000.0_pReal) & prm%omega = pl%get_asFloat('omega', defaultVal = 1000.0_pReal) &
* merge(12.0_pReal,8.0_pReal,any(lattice_structure(p) == [lattice_FCC_ID,lattice_HEX_ID])) * merge(12.0_pReal,8.0_pReal,any(lattice_structure(p) == [lattice_FCC_ID,lattice_HEX_ID]))
! expand: family => system ! expand: family => system
@ -231,17 +248,17 @@ module subroutine plastic_dislotwin_init
prm%B = math_expand(prm%B, N_sl) prm%B = math_expand(prm%B, N_sl)
! sanity checks ! sanity checks
if ( prm%D0 <= 0.0_pReal) extmsg = trim(extmsg)//' D0' if ( prm%D0 <= 0.0_pReal) extmsg = trim(extmsg)//' D_0'
if ( prm%Qsd <= 0.0_pReal) extmsg = trim(extmsg)//' Qsd' if ( prm%Qsd <= 0.0_pReal) extmsg = trim(extmsg)//' Q_cl'
if (any(rho_mob_0 < 0.0_pReal)) extmsg = trim(extmsg)//' rho_mob_0' if (any(rho_mob_0 < 0.0_pReal)) extmsg = trim(extmsg)//' rho_mob_0'
if (any(rho_dip_0 < 0.0_pReal)) extmsg = trim(extmsg)//' rho_dip_0' if (any(rho_dip_0 < 0.0_pReal)) extmsg = trim(extmsg)//' rho_dip_0'
if (any(prm%v0 < 0.0_pReal)) extmsg = trim(extmsg)//' v0' if (any(prm%v0 < 0.0_pReal)) extmsg = trim(extmsg)//' v_0'
if (any(prm%b_sl <= 0.0_pReal)) extmsg = trim(extmsg)//' b_sl' if (any(prm%b_sl <= 0.0_pReal)) extmsg = trim(extmsg)//' b_sl'
if (any(prm%Delta_F <= 0.0_pReal)) extmsg = trim(extmsg)//' Delta_F' if (any(prm%Delta_F <= 0.0_pReal)) extmsg = trim(extmsg)//' Q_s'
if (any(prm%CLambdaSlip <= 0.0_pReal)) extmsg = trim(extmsg)//' CLambdaSlip' if (any(prm%CLambdaSlip <= 0.0_pReal)) extmsg = trim(extmsg)//' i_sl'
if (any(prm%B < 0.0_pReal)) extmsg = trim(extmsg)//' B' if (any(prm%B < 0.0_pReal)) extmsg = trim(extmsg)//' B'
if (any(prm%p<=0.0_pReal .or. prm%p>1.0_pReal)) extmsg = trim(extmsg)//' p' if (any(prm%p<=0.0_pReal .or. prm%p>1.0_pReal)) extmsg = trim(extmsg)//' p_sl'
if (any(prm%q< 1.0_pReal .or. prm%q>2.0_pReal)) extmsg = trim(extmsg)//' q' if (any(prm%q< 1.0_pReal .or. prm%q>2.0_pReal)) extmsg = trim(extmsg)//' q_sl'
else slipActive else slipActive
rho_mob_0 = emptyRealArray; rho_dip_0 = emptyRealArray rho_mob_0 = emptyRealArray; rho_dip_0 = emptyRealArray
allocate(prm%b_sl,prm%Delta_F,prm%v0,prm%CLambdaSlip,prm%p,prm%q,prm%B,source=emptyRealArray) allocate(prm%b_sl,prm%Delta_F,prm%v0,prm%CLambdaSlip,prm%p,prm%q,prm%B,source=emptyRealArray)
@ -250,31 +267,31 @@ module subroutine plastic_dislotwin_init
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! twin related parameters ! twin related parameters
N_tw = config%getInts('ntwin', defaultVal=emptyIntArray) N_tw = pl%get_asInts('N_tw', defaultVal=emptyIntArray)
prm%sum_N_tw = sum(abs(N_tw)) prm%sum_N_tw = sum(abs(N_tw))
twinActive: if (prm%sum_N_tw > 0) then twinActive: if (prm%sum_N_tw > 0) then
prm%P_tw = lattice_SchmidMatrix_twin(N_tw,config%getString('lattice_structure'),& prm%P_tw = lattice_SchmidMatrix_twin(N_tw,phase%get_asString('lattice'),&
config%getFloat('c/a',defaultVal=0.0_pReal)) phase%get_asFloat('c/a',defaultVal=0.0_pReal))
prm%h_tw_tw = lattice_interaction_TwinByTwin(N_tw,& prm%h_tw_tw = lattice_interaction_TwinByTwin(N_tw,&
config%getFloats('interaction_twintwin'), & pl%get_asFloats('h_tw_tw'), &
config%getString('lattice_structure')) phase%get_asString('lattice'))
prm%b_tw = config%getFloats('twinburgers', requiredSize=size(N_tw)) prm%b_tw = pl%get_asFloats('b_tw', requiredSize=size(N_tw))
prm%t_tw = config%getFloats('twinsize', requiredSize=size(N_tw)) prm%t_tw = pl%get_asFloats('t_tw', requiredSize=size(N_tw))
prm%r = config%getFloats('r_twin', requiredSize=size(N_tw)) prm%r = pl%get_asFloats('p_tw', requiredSize=size(N_tw))
prm%xc_twin = config%getFloat('xc_twin') prm%xc_twin = pl%get_asFloat('x_c_tw')
prm%L_tw = config%getFloat('l0_twin') prm%L_tw = pl%get_asFloat('L_tw')
prm%i_tw = config%getFloat('cmfptwin') prm%i_tw = pl%get_asFloat('i_tw')
prm%gamma_char= lattice_characteristicShear_Twin(N_tw,config%getString('lattice_structure'),& prm%gamma_char= lattice_characteristicShear_Twin(N_tw,phase%get_asString('lattice'),&
config%getFloat('c/a',defaultVal=0.0_pReal)) phase%get_asFloat('c/a',defaultVal=0.0_pReal))
prm%C66_tw = lattice_C66_twin(N_tw,prm%C66,config%getString('lattice_structure'),& prm%C66_tw = lattice_C66_twin(N_tw,prm%C66,phase%get_asString('lattice'),&
config%getFloat('c/a',defaultVal=0.0_pReal)) phase%get_asFloat('c/a',defaultVal=0.0_pReal))
if (.not. prm%fccTwinTransNucleation) then if (.not. prm%fccTwinTransNucleation) then
prm%dot_N_0_tw = config%getFloats('ndot0_twin') prm%dot_N_0_tw = pl%get_asFloats('dot_N_0_tw')
prm%dot_N_0_tw = math_expand(prm%dot_N_0_tw,N_tw) prm%dot_N_0_tw = math_expand(prm%dot_N_0_tw,N_tw)
endif endif
@ -284,12 +301,12 @@ module subroutine plastic_dislotwin_init
prm%r = math_expand(prm%r,N_tw) prm%r = math_expand(prm%r,N_tw)
! sanity checks ! sanity checks
if ( prm%xc_twin < 0.0_pReal) extmsg = trim(extmsg)//' xc_twin' if ( prm%xc_twin < 0.0_pReal) extmsg = trim(extmsg)//' x_c_twin'
if ( prm%L_tw < 0.0_pReal) extmsg = trim(extmsg)//' L_tw' if ( prm%L_tw < 0.0_pReal) extmsg = trim(extmsg)//' L_tw'
if ( prm%i_tw < 0.0_pReal) extmsg = trim(extmsg)//' i_tw' if ( prm%i_tw < 0.0_pReal) extmsg = trim(extmsg)//' i_tw'
if (any(prm%b_tw < 0.0_pReal)) extmsg = trim(extmsg)//' b_tw' if (any(prm%b_tw < 0.0_pReal)) extmsg = trim(extmsg)//' b_tw'
if (any(prm%t_tw < 0.0_pReal)) extmsg = trim(extmsg)//' t_tw' if (any(prm%t_tw < 0.0_pReal)) extmsg = trim(extmsg)//' t_tw'
if (any(prm%r < 0.0_pReal)) extmsg = trim(extmsg)//' r' if (any(prm%r < 0.0_pReal)) extmsg = trim(extmsg)//' p_tw'
if (.not. prm%fccTwinTransNucleation) then if (.not. prm%fccTwinTransNucleation) then
if (any(prm%dot_N_0_tw < 0.0_pReal)) extmsg = trim(extmsg)//' dot_N_0_tw' if (any(prm%dot_N_0_tw < 0.0_pReal)) extmsg = trim(extmsg)//' dot_N_0_tw'
endif endif
@ -300,46 +317,46 @@ module subroutine plastic_dislotwin_init
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! transformation related parameters ! transformation related parameters
N_tr = config%getInts('ntrans', defaultVal=emptyIntArray) N_tr = pl%get_asInts('N_tr', defaultVal=emptyIntArray)
prm%sum_N_tr = sum(abs(N_tr)) prm%sum_N_tr = sum(abs(N_tr))
transActive: if (prm%sum_N_tr > 0) then transActive: if (prm%sum_N_tr > 0) then
prm%b_tr = config%getFloats('transburgers') prm%b_tr = pl%get_asFloats('b_tr')
prm%b_tr = math_expand(prm%b_tr,N_tr) prm%b_tr = math_expand(prm%b_tr,N_tr)
prm%h = config%getFloat('transstackheight', defaultVal=0.0_pReal) ! ToDo: How to handle that??? prm%h = pl%get_asFloat('h', defaultVal=0.0_pReal) ! ToDo: How to handle that???
prm%i_tr = config%getFloat('cmfptrans', defaultVal=0.0_pReal) ! ToDo: How to handle that??? prm%i_tr = pl%get_asFloat('i_tr', defaultVal=0.0_pReal) ! ToDo: How to handle that???
prm%gamma_fcc_hex = config%getFloat('deltag') prm%gamma_fcc_hex = pl%get_asFloat('delta_G')
prm%xc_trans = config%getFloat('xc_trans', defaultVal=0.0_pReal) ! ToDo: How to handle that??? prm%xc_trans = pl%get_asFloat('x_c_tr', defaultVal=0.0_pReal) ! ToDo: How to handle that???
prm%L_tr = config%getFloat('l0_trans') prm%L_tr = pl%get_asFloat('L_tr')
prm%h_tr_tr = lattice_interaction_TransByTrans(N_tr,config%getFloats('interaction_transtrans'), & prm%h_tr_tr = lattice_interaction_TransByTrans(N_tr,pl%get_asFloats('h_tr_tr'), &
config%getString('lattice_structure')) phase%get_asString('lattice'))
prm%C66_tr = lattice_C66_trans(N_tr,prm%C66,config%getString('trans_lattice_structure'), & prm%C66_tr = lattice_C66_trans(N_tr,prm%C66,pl%get_asString('trans_lattice_structure'), &
0.0_pReal, & 0.0_pReal, &
config%getFloat('a_bcc', defaultVal=0.0_pReal), & pl%get_asFloat('a_bcc', defaultVal=0.0_pReal), &
config%getFloat('a_fcc', defaultVal=0.0_pReal)) pl%get_asFloat('a_fcc', defaultVal=0.0_pReal))
prm%P_tr = lattice_SchmidMatrix_trans(N_tr,config%getString('trans_lattice_structure'), & prm%P_tr = lattice_SchmidMatrix_trans(N_tr,pl%get_asString('trans_lattice_structure'), &
0.0_pReal, & 0.0_pReal, &
config%getFloat('a_bcc', defaultVal=0.0_pReal), & pl%get_asFloat('a_bcc', defaultVal=0.0_pReal), &
config%getFloat('a_fcc', defaultVal=0.0_pReal)) pl%get_asFloat('a_fcc', defaultVal=0.0_pReal))
if (lattice_structure(p) /= lattice_FCC_ID) then if (lattice_structure(p) /= lattice_FCC_ID) then
prm%dot_N_0_tr = config%getFloats('ndot0_trans') prm%dot_N_0_tr = pl%get_asFloats('dot_N_0_tr')
prm%dot_N_0_tr = math_expand(prm%dot_N_0_tr,N_tr) prm%dot_N_0_tr = math_expand(prm%dot_N_0_tr,N_tr)
endif endif
prm%t_tr = config%getFloats('lamellarsize') prm%t_tr = pl%get_asFloats('t_tr')
prm%t_tr = math_expand(prm%t_tr,N_tr) prm%t_tr = math_expand(prm%t_tr,N_tr)
prm%s = config%getFloats('s_trans',defaultVal=[0.0_pReal]) prm%s = pl%get_asFloats('p_tr',defaultVal=[0.0_pReal])
prm%s = math_expand(prm%s,N_tr) prm%s = math_expand(prm%s,N_tr)
! sanity checks ! sanity checks
if ( prm%xc_trans < 0.0_pReal) extmsg = trim(extmsg)//' xc_trans' if ( prm%xc_trans < 0.0_pReal) extmsg = trim(extmsg)//' x_c_trans'
if ( prm%L_tr < 0.0_pReal) extmsg = trim(extmsg)//' L_tr' if ( prm%L_tr < 0.0_pReal) extmsg = trim(extmsg)//' L_tr'
if ( prm%i_tr < 0.0_pReal) extmsg = trim(extmsg)//' i_tr' if ( prm%i_tr < 0.0_pReal) extmsg = trim(extmsg)//' i_tr'
if (any(prm%t_tr < 0.0_pReal)) extmsg = trim(extmsg)//' t_tr' if (any(prm%t_tr < 0.0_pReal)) extmsg = trim(extmsg)//' t_tr'
if (any(prm%s < 0.0_pReal)) extmsg = trim(extmsg)//' s' if (any(prm%s < 0.0_pReal)) extmsg = trim(extmsg)//' p_tr'
if (lattice_structure(p) /= lattice_FCC_ID) then if (lattice_structure(p) /= lattice_FCC_ID) then
if (any(prm%dot_N_0_tr < 0.0_pReal)) extmsg = trim(extmsg)//' dot_N_0_tr' if (any(prm%dot_N_0_tr < 0.0_pReal)) extmsg = trim(extmsg)//' dot_N_0_tr'
endif endif
@ -350,42 +367,42 @@ module subroutine plastic_dislotwin_init
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! shearband related parameters ! shearband related parameters
prm%sbVelocity = config%getFloat('shearbandvelocity',defaultVal=0.0_pReal) prm%sbVelocity = pl%get_asFloat('v_sb',defaultVal=0.0_pReal)
if (prm%sbVelocity > 0.0_pReal) then if (prm%sbVelocity > 0.0_pReal) then
prm%sbResistance = config%getFloat('shearbandresistance') prm%sbResistance = pl%get_asFloat('xi_sb')
prm%E_sb = config%getFloat('qedgepersbsystem') prm%E_sb = pl%get_asFloat('Q_sb')
prm%p_sb = config%getFloat('p_shearband') prm%p_sb = pl%get_asFloat('p_sb')
prm%q_sb = config%getFloat('q_shearband') prm%q_sb = pl%get_asFloat('q_sb')
! sanity checks ! sanity checks
if (prm%sbResistance < 0.0_pReal) extmsg = trim(extmsg)//' shearbandresistance' if (prm%sbResistance < 0.0_pReal) extmsg = trim(extmsg)//' xi_sb'
if (prm%E_sb < 0.0_pReal) extmsg = trim(extmsg)//' qedgepersbsystem' if (prm%E_sb < 0.0_pReal) extmsg = trim(extmsg)//' Q_sb'
if (prm%p_sb <= 0.0_pReal) extmsg = trim(extmsg)//' p_shearband' if (prm%p_sb <= 0.0_pReal) extmsg = trim(extmsg)//' p_sb'
if (prm%q_sb <= 0.0_pReal) extmsg = trim(extmsg)//' q_shearband' if (prm%q_sb <= 0.0_pReal) extmsg = trim(extmsg)//' q_sb'
endif endif
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! parameters required for several mechanisms and their interactions ! parameters required for several mechanisms and their interactions
if(prm%sum_N_sl + prm%sum_N_tw + prm%sum_N_tw > 0) & if(prm%sum_N_sl + prm%sum_N_tw + prm%sum_N_tw > 0) &
prm%D = config%getFloat('grainsize') prm%D = pl%get_asFloat('D')
twinOrSlipActive: if (prm%sum_N_tw + prm%sum_N_tr > 0) then twinOrSlipActive: if (prm%sum_N_tw + prm%sum_N_tr > 0) then
prm%SFE_0K = config%getFloat('sfe_0k') prm%SFE_0K = pl%get_asFloat('Gamma_sf_0K')
prm%dSFE_dT = config%getFloat('dsfe_dt') prm%dSFE_dT = pl%get_asFloat('dGamma_sf_dT')
prm%V_cs = config%getFloat('vcrossslip') prm%V_cs = pl%get_asFloat('V_cs')
endif twinOrSlipActive endif twinOrSlipActive
slipAndTwinActive: if (prm%sum_N_sl * prm%sum_N_tw > 0) then slipAndTwinActive: if (prm%sum_N_sl * prm%sum_N_tw > 0) then
prm%h_sl_tw = lattice_interaction_SlipByTwin(N_sl,N_tw,& prm%h_sl_tw = lattice_interaction_SlipByTwin(N_sl,N_tw,&
config%getFloats('interaction_sliptwin'), & pl%get_asFloats('h_sl_tw'), &
config%getString('lattice_structure')) phase%get_asString('lattice'))
if (prm%fccTwinTransNucleation .and. size(N_tw) /= 1) extmsg = trim(extmsg)//' interaction_sliptwin' if (prm%fccTwinTransNucleation .and. size(N_tw) /= 1) extmsg = trim(extmsg)//' interaction_sliptwin'
endif slipAndTwinActive endif slipAndTwinActive
slipAndTransActive: if (prm%sum_N_sl * prm%sum_N_tr > 0) then slipAndTransActive: if (prm%sum_N_sl * prm%sum_N_tr > 0) then
prm%h_sl_tr = lattice_interaction_SlipByTrans(N_sl,N_tr,& prm%h_sl_tr = lattice_interaction_SlipByTrans(N_sl,N_tr,&
config%getFloats('interaction_sliptrans'), & pl%get_asFloats('h_sl_tr'), &
config%getString('lattice_structure')) phase%get_asString('lattice'))
if (prm%fccTwinTransNucleation .and. size(N_tr) /= 1) extmsg = trim(extmsg)//' interaction_sliptrans' if (prm%fccTwinTransNucleation .and. size(N_tr) /= 1) extmsg = trim(extmsg)//' interaction_sliptrans'
endif slipAndTransActive endif slipAndTransActive
@ -397,7 +414,8 @@ module subroutine plastic_dislotwin_init
+ size(['f_tr']) * prm%sum_N_tr + size(['f_tr']) * prm%sum_N_tr
sizeState = sizeDotState sizeState = sizeDotState
call material_allocateState(plasticState(p),NipcMyPhase,sizeState,sizeDotState,0)
call constitutive_allocateState(plasticState(p),NipcMyPhase,sizeState,sizeDotState,0)
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! locally defined state aliases and initialization of state0 and atol ! locally defined state aliases and initialization of state0 and atol
@ -406,7 +424,7 @@ module subroutine plastic_dislotwin_init
stt%rho_mob=>plasticState(p)%state(startIndex:endIndex,:) stt%rho_mob=>plasticState(p)%state(startIndex:endIndex,:)
stt%rho_mob= spread(rho_mob_0,2,NipcMyPhase) stt%rho_mob= spread(rho_mob_0,2,NipcMyPhase)
dot%rho_mob=>plasticState(p)%dotState(startIndex:endIndex,:) dot%rho_mob=>plasticState(p)%dotState(startIndex:endIndex,:)
plasticState(p)%atol(startIndex:endIndex) = config%getFloat('atol_rho',defaultVal=1.0_pReal) plasticState(p)%atol(startIndex:endIndex) = pl%get_asFloat('atol_rho',defaultVal=1.0_pReal)
if (any(plasticState(p)%atol(startIndex:endIndex) < 0.0_pReal)) extmsg = trim(extmsg)//' atol_rho' if (any(plasticState(p)%atol(startIndex:endIndex) < 0.0_pReal)) extmsg = trim(extmsg)//' atol_rho'
startIndex = endIndex + 1 startIndex = endIndex + 1
@ -414,7 +432,7 @@ module subroutine plastic_dislotwin_init
stt%rho_dip=>plasticState(p)%state(startIndex:endIndex,:) stt%rho_dip=>plasticState(p)%state(startIndex:endIndex,:)
stt%rho_dip= spread(rho_dip_0,2,NipcMyPhase) stt%rho_dip= spread(rho_dip_0,2,NipcMyPhase)
dot%rho_dip=>plasticState(p)%dotState(startIndex:endIndex,:) dot%rho_dip=>plasticState(p)%dotState(startIndex:endIndex,:)
plasticState(p)%atol(startIndex:endIndex) = config%getFloat('atol_rho',defaultVal=1.0_pReal) plasticState(p)%atol(startIndex:endIndex) = pl%get_asFloat('atol_rho',defaultVal=1.0_pReal)
startIndex = endIndex + 1 startIndex = endIndex + 1
endIndex = endIndex + prm%sum_N_sl endIndex = endIndex + prm%sum_N_sl
@ -428,14 +446,14 @@ module subroutine plastic_dislotwin_init
endIndex = endIndex + prm%sum_N_tw endIndex = endIndex + prm%sum_N_tw
stt%f_tw=>plasticState(p)%state(startIndex:endIndex,:) stt%f_tw=>plasticState(p)%state(startIndex:endIndex,:)
dot%f_tw=>plasticState(p)%dotState(startIndex:endIndex,:) dot%f_tw=>plasticState(p)%dotState(startIndex:endIndex,:)
plasticState(p)%atol(startIndex:endIndex) = config%getFloat('f_twin',defaultVal=1.0e-7_pReal) plasticState(p)%atol(startIndex:endIndex) = pl%get_asFloat('f_twin',defaultVal=1.0e-7_pReal)
if (any(plasticState(p)%atol(startIndex:endIndex) < 0.0_pReal)) extmsg = trim(extmsg)//' f_twin' if (any(plasticState(p)%atol(startIndex:endIndex) < 0.0_pReal)) extmsg = trim(extmsg)//' f_twin'
startIndex = endIndex + 1 startIndex = endIndex + 1
endIndex = endIndex + prm%sum_N_tr endIndex = endIndex + prm%sum_N_tr
stt%f_tr=>plasticState(p)%state(startIndex:endIndex,:) stt%f_tr=>plasticState(p)%state(startIndex:endIndex,:)
dot%f_tr=>plasticState(p)%dotState(startIndex:endIndex,:) dot%f_tr=>plasticState(p)%dotState(startIndex:endIndex,:)
plasticState(p)%atol(startIndex:endIndex) = config%getFloat('f_trans',defaultVal=1.0e-6_pReal) plasticState(p)%atol(startIndex:endIndex) = pl%get_asFloat('f_trans',defaultVal=1.0e-6_pReal)
if (any(plasticState(p)%atol(startIndex:endIndex) < 0.0_pReal)) extmsg = trim(extmsg)//' f_trans' if (any(plasticState(p)%atol(startIndex:endIndex) < 0.0_pReal)) extmsg = trim(extmsg)//' f_trans'
allocate(dst%Lambda_sl (prm%sum_N_sl,NipcMyPhase),source=0.0_pReal) allocate(dst%Lambda_sl (prm%sum_N_sl,NipcMyPhase),source=0.0_pReal)
@ -457,11 +475,11 @@ module subroutine plastic_dislotwin_init
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! exit if any parameter is out of range ! exit if any parameter is out of range
if (extmsg /= '') call IO_error(211,ext_msg=trim(extmsg)//'('//PLASTICITY_DISLOTWIN_LABEL//')') if (extmsg /= '') call IO_error(211,ext_msg=trim(extmsg)//'(dislotwin)')
enddo enddo
end subroutine plastic_dislotwin_init end function plastic_dislotwin_init
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
@ -824,33 +842,33 @@ module subroutine plastic_dislotwin_results(instance,group)
select case(trim(prm%output(o))) select case(trim(prm%output(o)))
case('rho_mob') case('rho_mob')
if(prm%sum_N_sl>0) call results_writeDataset(group,stt%rho_mob,'rho_mob',& if(prm%sum_N_sl>0) call results_writeDataset(group,stt%rho_mob,trim(prm%output(o)), &
'mobile dislocation density','1/m²') 'mobile dislocation density','1/m²')
case('rho_dip') case('rho_dip')
if(prm%sum_N_sl>0) call results_writeDataset(group,stt%rho_dip,'rho_dip',& if(prm%sum_N_sl>0) call results_writeDataset(group,stt%rho_dip,trim(prm%output(o)), &
'dislocation dipole density','1/m²') 'dislocation dipole density','1/m²')
case('gamma_sl') case('gamma_sl')
if(prm%sum_N_sl>0) call results_writeDataset(group,stt%gamma_sl,'gamma_sl',& if(prm%sum_N_sl>0) call results_writeDataset(group,stt%gamma_sl,trim(prm%output(o)), &
'plastic shear','1') 'plastic shear','1')
case('lambda_sl') case('Lambda_sl')
if(prm%sum_N_sl>0) call results_writeDataset(group,dst%Lambda_sl,'Lambda_sl',& if(prm%sum_N_sl>0) call results_writeDataset(group,dst%Lambda_sl,trim(prm%output(o)), &
'mean free path for slip','m') 'mean free path for slip','m')
case('tau_pass') case('tau_pass')
if(prm%sum_N_sl>0) call results_writeDataset(group,dst%tau_pass,'tau_pass',& if(prm%sum_N_sl>0) call results_writeDataset(group,dst%tau_pass,trim(prm%output(o)), &
'passing stress for slip','Pa') 'passing stress for slip','Pa')
case('f_tw') case('f_tw')
if(prm%sum_N_tw>0) call results_writeDataset(group,stt%f_tw,'f_tw',& if(prm%sum_N_tw>0) call results_writeDataset(group,stt%f_tw,trim(prm%output(o)), &
'twinned volume fraction','m³/m³') 'twinned volume fraction','m³/m³')
case('lambda_tw') case('Lambda_tw')
if(prm%sum_N_tw>0) call results_writeDataset(group,dst%Lambda_tw,'Lambda_tw',& if(prm%sum_N_tw>0) call results_writeDataset(group,dst%Lambda_tw,trim(prm%output(o)), &
'mean free path for twinning','m') 'mean free path for twinning','m')
case('tau_hat_tw') case('tau_hat_tw')
if(prm%sum_N_tw>0) call results_writeDataset(group,dst%tau_hat_tw,'tau_hat_tw',& if(prm%sum_N_tw>0) call results_writeDataset(group,dst%tau_hat_tw,trim(prm%output(o)), &
'threshold stress for twinning','Pa') 'threshold stress for twinning','Pa')
case('f_tr') case('f_tr')
if(prm%sum_N_tr>0) call results_writeDataset(group,stt%f_tr,'f_tr',& if(prm%sum_N_tr>0) call results_writeDataset(group,stt%f_tr,trim(prm%output(o)), &
'martensite volume fraction','m³/m³') 'martensite volume fraction','m³/m³')
end select end select

View File

@ -49,58 +49,78 @@ contains
!> @brief Perform module initialization. !> @brief Perform module initialization.
!> @details reads in material parameters, allocates arrays, and does sanity checks !> @details reads in material parameters, allocates arrays, and does sanity checks
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
module subroutine plastic_isotropic_init module function plastic_isotropic_init() result(myPlasticity)
logical, dimension(:), allocatable :: myPlasticity
integer :: & integer :: &
Ninstance, & Ninstance, &
p, & p, &
i, &
NipcMyPhase, & NipcMyPhase, &
sizeState, sizeDotState sizeState, sizeDotState
real(pReal) :: & real(pReal) :: &
xi_0 !< initial critical stress xi_0 !< initial critical stress
character(len=pStringLen) :: & character(len=pStringLen) :: &
extmsg = '' extmsg = ''
class(tNode), pointer :: &
phases, &
phase, &
pl
write(6,'(/,a)') ' <<<+- plastic_'//PLASTICITY_ISOTROPIC_LABEL//' init -+>>>' write(6,'(/,a)') ' <<<+- plastic_isotropic init -+>>>'
write(6,'(/,a)') ' Maiti and Eisenlohr, Scripta Materialia 145:3740, 2018' write(6,'(/,a)') ' Maiti and Eisenlohr, Scripta Materialia 145:3740, 2018'
write(6,'(a)') ' https://doi.org/10.1016/j.scriptamat.2017.09.047' write(6,'(a)') ' https://doi.org/10.1016/j.scriptamat.2017.09.047'
Ninstance = count(phase_plasticity == PLASTICITY_ISOTROPIC_ID)
myPlasticity = plastic_active('isotropic')
Ninstance = count(myPlasticity)
write(6,'(a16,1x,i5,/)') '# instances:',Ninstance; flush(6) write(6,'(a16,1x,i5,/)') '# instances:',Ninstance; flush(6)
if(Ninstance == 0) return
allocate(param(Ninstance)) allocate(param(Ninstance))
allocate(state(Ninstance)) allocate(state(Ninstance))
allocate(dotState(Ninstance)) allocate(dotState(Ninstance))
do p = 1, size(phase_plasticity) phases => material_root%get('phase')
if (phase_plasticity(p) /= PLASTICITY_ISOTROPIC_ID) cycle i = 0
associate(prm => param(phase_plasticityInstance(p)), & do p = 1, phases%length
dot => dotState(phase_plasticityInstance(p)), & phase => phases%get(p)
stt => state(phase_plasticityInstance(p)), &
config => config_phase(p))
prm%output = config%getStrings('(output)',defaultVal=emptyStringArray) if(.not. myPlasticity(p)) cycle
i = i + 1
associate(prm => param(i), &
dot => dotState(i), &
stt => state(i))
pl => phase%get('plasticity')
#if defined (__GFORTRAN__)
prm%output = output_asStrings(pl)
#else
prm%output = pl%get_asStrings('output',defaultVal=emptyStringArray)
#endif
#ifdef DEBUG #ifdef DEBUG
if (p==material_phaseAt(debugConstitutive%grain,debugConstitutive%element)) & if (p==material_phaseAt(debugConstitutive%grain,debugConstitutive%element)) &
prm%of_debug = material_phasememberAt(debugConstitutive%grain,debugConstitutive%ip,debugConstitutive%element) prm%of_debug = material_phasememberAt(debugConstitutive%grain,debugConstitutive%ip,debugConstitutive%element)
#endif #endif
xi_0 = config%getFloat('tau0') xi_0 = pl%get_asFloat('xi_0')
prm%xi_inf = config%getFloat('tausat') prm%xi_inf = pl%get_asFloat('xi_inf')
prm%dot_gamma_0 = config%getFloat('gdot0') prm%dot_gamma_0 = pl%get_asFloat('dot_gamma_0')
prm%n = config%getFloat('n') prm%n = pl%get_asFloat('n')
prm%h0 = config%getFloat('h0') prm%h0 = pl%get_asFloat('h_0')
prm%M = config%getFloat('m') prm%M = pl%get_asFloat('M')
prm%h_ln = config%getFloat('h0_slopelnrate', defaultVal=0.0_pReal) prm%h_ln = pl%get_asFloat('h_ln', defaultVal=0.0_pReal)
prm%c_1 = config%getFloat('tausat_sinhfita',defaultVal=0.0_pReal) prm%c_1 = pl%get_asFloat('c_1', defaultVal=0.0_pReal)
prm%c_4 = config%getFloat('tausat_sinhfitb',defaultVal=0.0_pReal) prm%c_4 = pl%get_asFloat('c_4', defaultVal=0.0_pReal)
prm%c_3 = config%getFloat('tausat_sinhfitc',defaultVal=0.0_pReal) prm%c_3 = pl%get_asFloat('c_3', defaultVal=0.0_pReal)
prm%c_2 = config%getFloat('tausat_sinhfitd',defaultVal=0.0_pReal) prm%c_2 = pl%get_asFloat('c_2', defaultVal=0.0_pReal)
prm%a = config%getFloat('a') prm%a = pl%get_asFloat('a')
prm%dilatation = config%keyExists('/dilatation/') prm%dilatation = pl%get_AsBool('dilatation',defaultVal = .false.)
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! sanity checks ! sanity checks
@ -113,22 +133,22 @@ module subroutine plastic_isotropic_init
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! allocate state arrays ! allocate state arrays
NipcMyPhase = count(material_phaseAt == p) * discretization_nIP NipcMyPhase = count(material_phaseAt == p) * discretization_nIP
sizeDotState = size(['xi ','accumulated_shear']) sizeDotState = size(['xi ','gamma'])
sizeState = sizeDotState sizeState = sizeDotState
call material_allocateState(plasticState(p),NipcMyPhase,sizeState,sizeDotState,0) call constitutive_allocateState(plasticState(p),NipcMyPhase,sizeState,sizeDotState,0)
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! state aliases and initialization ! state aliases and initialization
stt%xi => plasticState(p)%state (1,:) stt%xi => plasticState(p)%state (1,:)
stt%xi = xi_0 stt%xi = xi_0
dot%xi => plasticState(p)%dotState(1,:) dot%xi => plasticState(p)%dotState(1,:)
plasticState(p)%atol(1) = config%getFloat('atol_xi',defaultVal=1.0_pReal) plasticState(p)%atol(1) = pl%get_asFloat('atol_xi',defaultVal=1.0_pReal)
if (plasticState(p)%atol(1) < 0.0_pReal) extmsg = trim(extmsg)//' atol_xi' if (plasticState(p)%atol(1) < 0.0_pReal) extmsg = trim(extmsg)//' atol_xi'
stt%gamma => plasticState(p)%state (2,:) stt%gamma => plasticState(p)%state (2,:)
dot%gamma => plasticState(p)%dotState(2,:) dot%gamma => plasticState(p)%dotState(2,:)
plasticState(p)%atol(2) = config%getFloat('atol_gamma',defaultVal=1.0e-6_pReal) plasticState(p)%atol(2) = pl%get_asFloat('atol_gamma',defaultVal=1.0e-6_pReal)
if (plasticState(p)%atol(2) < 0.0_pReal) extmsg = trim(extmsg)//' atol_gamma' if (plasticState(p)%atol(2) < 0.0_pReal) extmsg = trim(extmsg)//' atol_gamma'
! global alias ! global alias
plasticState(p)%slipRate => plasticState(p)%dotState(2:2,:) plasticState(p)%slipRate => plasticState(p)%dotState(2:2,:)
@ -139,11 +159,11 @@ module subroutine plastic_isotropic_init
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! exit if any parameter is out of range ! exit if any parameter is out of range
if (extmsg /= '') call IO_error(211,ext_msg=trim(extmsg)//'('//PLASTICITY_ISOTROPIC_LABEL//')') if (extmsg /= '') call IO_error(211,ext_msg=trim(extmsg)//'(isotropic)')
enddo enddo
end subroutine plastic_isotropic_init end function plastic_isotropic_init
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
@ -319,8 +339,9 @@ module subroutine plastic_isotropic_results(instance,group)
associate(prm => param(instance), stt => state(instance)) associate(prm => param(instance), stt => state(instance))
outputsLoop: do o = 1,size(prm%output) outputsLoop: do o = 1,size(prm%output)
select case(trim(prm%output(o))) select case(trim(prm%output(o)))
case ('flowstress') ! ToDo: should be 'xi' case ('xi')
call results_writeDataset(group,stt%xi,'xi','resistance against plastic flow','Pa') call results_writeDataset(group,stt%xi,trim(prm%output(o)), &
'resistance against plastic flow','Pa')
end select end select
enddo outputsLoop enddo outputsLoop
end associate end associate

View File

@ -58,11 +58,12 @@ contains
!> @brief Perform module initialization. !> @brief Perform module initialization.
!> @details reads in material parameters, allocates arrays, and does sanity checks !> @details reads in material parameters, allocates arrays, and does sanity checks
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
module subroutine plastic_kinehardening_init module function plastic_kinehardening_init() result(myPlasticity)
logical, dimension(:), allocatable :: myPlasticity
integer :: & integer :: &
Ninstance, & Ninstance, &
p, o, & p, i, o, &
NipcMyPhase, & NipcMyPhase, &
sizeState, sizeDeltaState, sizeDotState, & sizeState, sizeDeltaState, sizeDotState, &
startIndex, endIndex startIndex, endIndex
@ -73,26 +74,42 @@ module subroutine plastic_kinehardening_init
a !< non-Schmid coefficients a !< non-Schmid coefficients
character(len=pStringLen) :: & character(len=pStringLen) :: &
extmsg = '' extmsg = ''
class(tNode), pointer :: &
phases, &
phase, &
pl
write(6,'(/,a)') ' <<<+- plastic_'//PLASTICITY_KINEHARDENING_LABEL//' init -+>>>' write(6,'(/,a)') ' <<<+- plastic_kinehardening init -+>>>'
Ninstance = count(phase_plasticity == PLASTICITY_KINEHARDENING_ID) myPlasticity = plastic_active('kinehardening')
Ninstance = count(myPlasticity)
write(6,'(a16,1x,i5,/)') '# instances:',Ninstance; flush(6) write(6,'(a16,1x,i5,/)') '# instances:',Ninstance; flush(6)
if(Ninstance == 0) return
allocate(param(Ninstance)) allocate(param(Ninstance))
allocate(state(Ninstance)) allocate(state(Ninstance))
allocate(dotState(Ninstance)) allocate(dotState(Ninstance))
allocate(deltaState(Ninstance)) allocate(deltaState(Ninstance))
do p = 1, size(phase_plasticityInstance) phases => material_root%get('phase')
if (phase_plasticity(p) /= PLASTICITY_KINEHARDENING_ID) cycle i = 0
associate(prm => param(phase_plasticityInstance(p)), & do p = 1, phases%length
dot => dotState(phase_plasticityInstance(p)), & phase => phases%get(p)
dlt => deltaState(phase_plasticityInstance(p)), &
stt => state(phase_plasticityInstance(p)),&
config => config_phase(p))
prm%output = config%getStrings('(output)',defaultVal=emptyStringArray) if(.not. myPlasticity(p)) cycle
i = i + 1
associate(prm => param(i), &
dot => dotState(i), &
dlt => deltaState(i), &
stt => state(i))
pl => phase%get('plasticity')
#if defined (__GFORTRAN__)
prm%output = output_asStrings(pl)
#else
prm%output = pl%get_asStrings('output',defaultVal=emptyStringArray)
#endif
#ifdef DEBUG #ifdef DEBUG
if (p==material_phaseAt(debugConstitutive%grain,debugConstitutive%element)) then if (p==material_phaseAt(debugConstitutive%grain,debugConstitutive%element)) then
@ -102,14 +119,14 @@ module subroutine plastic_kinehardening_init
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! slip related parameters ! slip related parameters
N_sl = config%getInts('nslip',defaultVal=emptyIntArray) N_sl = pl%get_asInts('N_sl',defaultVal=emptyIntArray)
prm%sum_N_sl = sum(abs(N_sl)) prm%sum_N_sl = sum(abs(N_sl))
slipActive: if (prm%sum_N_sl > 0) then slipActive: if (prm%sum_N_sl > 0) then
prm%P = lattice_SchmidMatrix_slip(N_sl,config%getString('lattice_structure'),& prm%P = lattice_SchmidMatrix_slip(N_sl,phase%get_asString('lattice'),&
config%getFloat('c/a',defaultVal=0.0_pReal)) phase%get_asFloat('c/a',defaultVal=0.0_pReal))
if(trim(config%getString('lattice_structure')) == 'bcc') then if(trim(phase%get_asString('lattice')) == 'bcc') then
a = config%getFloats('nonschmid_coefficients',defaultVal = emptyRealArray) a = pl%get_asFloats('nonSchmid_coefficients',defaultVal = emptyRealArray)
if(size(a) > 0) prm%nonSchmidActive = .true. if(size(a) > 0) prm%nonSchmidActive = .true.
prm%nonSchmid_pos = lattice_nonSchmidMatrix(N_sl,a,+1) prm%nonSchmid_pos = lattice_nonSchmidMatrix(N_sl,a,+1)
prm%nonSchmid_neg = lattice_nonSchmidMatrix(N_sl,a,-1) prm%nonSchmid_neg = lattice_nonSchmidMatrix(N_sl,a,-1)
@ -118,19 +135,19 @@ module subroutine plastic_kinehardening_init
prm%nonSchmid_neg = prm%P prm%nonSchmid_neg = prm%P
endif endif
prm%interaction_SlipSlip = lattice_interaction_SlipBySlip(N_sl, & prm%interaction_SlipSlip = lattice_interaction_SlipBySlip(N_sl, &
config%getFloats('interaction_slipslip'), & pl%get_asFloats('h_sl_sl'), &
config%getString('lattice_structure')) phase%get_asString('lattice'))
xi_0 = config%getFloats('crss0', requiredSize=size(N_sl)) xi_0 = pl%get_asFloats('xi_0', requiredSize=size(N_sl))
prm%tau1 = config%getFloats('tau1', requiredSize=size(N_sl)) prm%tau1 = pl%get_asFloats('xi_inf_f', requiredSize=size(N_sl))
prm%tau1_b = config%getFloats('tau1_b', requiredSize=size(N_sl)) prm%tau1_b = pl%get_asFloats('xi_inf_b', requiredSize=size(N_sl))
prm%theta0 = config%getFloats('theta0', requiredSize=size(N_sl)) prm%theta0 = pl%get_asFloats('h_0_f', requiredSize=size(N_sl))
prm%theta1 = config%getFloats('theta1', requiredSize=size(N_sl)) prm%theta1 = pl%get_asFloats('h_inf_f', requiredSize=size(N_sl))
prm%theta0_b = config%getFloats('theta0_b', requiredSize=size(N_sl)) prm%theta0_b = pl%get_asFloats('h_0_b', requiredSize=size(N_sl))
prm%theta1_b = config%getFloats('theta1_b', requiredSize=size(N_sl)) prm%theta1_b = pl%get_asFloats('h_inf_b', requiredSize=size(N_sl))
prm%gdot0 = config%getFloat('gdot0') prm%gdot0 = pl%get_asFloat('dot_gamma_0')
prm%n = config%getFloat('n_slip') prm%n = pl%get_asFloat('n')
! expand: family => system ! expand: family => system
xi_0 = math_expand(xi_0, N_sl) xi_0 = math_expand(xi_0, N_sl)
@ -143,11 +160,11 @@ module subroutine plastic_kinehardening_init
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! sanity checks ! sanity checks
if ( prm%gdot0 <= 0.0_pReal) extmsg = trim(extmsg)//' gdot0' if ( prm%gdot0 <= 0.0_pReal) extmsg = trim(extmsg)//' dot_gamma_0'
if ( prm%n <= 0.0_pReal) extmsg = trim(extmsg)//' n_slip' if ( prm%n <= 0.0_pReal) extmsg = trim(extmsg)//' n'
if (any(xi_0 <= 0.0_pReal)) extmsg = trim(extmsg)//' crss0' if (any(xi_0 <= 0.0_pReal)) extmsg = trim(extmsg)//' xi_0'
if (any(prm%tau1 <= 0.0_pReal)) extmsg = trim(extmsg)//' tau1' if (any(prm%tau1 <= 0.0_pReal)) extmsg = trim(extmsg)//' xi_inf_f'
if (any(prm%tau1_b <= 0.0_pReal)) extmsg = trim(extmsg)//' tau1_b' if (any(prm%tau1_b <= 0.0_pReal)) extmsg = trim(extmsg)//' xi_inf_b'
!ToDo: Any sensible checks for theta? !ToDo: Any sensible checks for theta?
else slipActive else slipActive
@ -159,11 +176,11 @@ module subroutine plastic_kinehardening_init
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! allocate state arrays ! allocate state arrays
NipcMyPhase = count(material_phaseAt == p) * discretization_nIP NipcMyPhase = count(material_phaseAt == p) * discretization_nIP
sizeDotState = size(['crss ','crss_back', 'accshear ']) * prm%sum_N_sl sizeDotState = size(['crss ','crss_back', 'accshear ']) * prm%sum_N_sl!ToDo: adjust names, ask Philip
sizeDeltaState = size(['sense ', 'chi0 ', 'gamma0' ]) * prm%sum_N_sl sizeDeltaState = size(['sense ', 'chi0 ', 'gamma0' ]) * prm%sum_N_sl !ToDo: adjust names
sizeState = sizeDotState + sizeDeltaState sizeState = sizeDotState + sizeDeltaState
call material_allocateState(plasticState(p),NipcMyPhase,sizeState,sizeDotState,sizeDeltaState) call constitutive_allocateState(plasticState(p),NipcMyPhase,sizeState,sizeDotState,sizeDeltaState)
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! state aliases and initialization ! state aliases and initialization
@ -172,20 +189,20 @@ module subroutine plastic_kinehardening_init
stt%crss => plasticState(p)%state (startIndex:endIndex,:) stt%crss => plasticState(p)%state (startIndex:endIndex,:)
stt%crss = spread(xi_0, 2, NipcMyPhase) stt%crss = spread(xi_0, 2, NipcMyPhase)
dot%crss => plasticState(p)%dotState(startIndex:endIndex,:) dot%crss => plasticState(p)%dotState(startIndex:endIndex,:)
plasticState(p)%atol(startIndex:endIndex) = config%getFloat('atol_xi',defaultVal=1.0_pReal) plasticState(p)%atol(startIndex:endIndex) = pl%get_asFloat('atol_xi',defaultVal=1.0_pReal)
if(any(plasticState(p)%atol(startIndex:endIndex) < 0.0_pReal)) extmsg = trim(extmsg)//' atol_xi' if(any(plasticState(p)%atol(startIndex:endIndex) < 0.0_pReal)) extmsg = trim(extmsg)//' atol_xi'
startIndex = endIndex + 1 startIndex = endIndex + 1
endIndex = endIndex + prm%sum_N_sl endIndex = endIndex + prm%sum_N_sl
stt%crss_back => plasticState(p)%state (startIndex:endIndex,:) stt%crss_back => plasticState(p)%state (startIndex:endIndex,:)
dot%crss_back => plasticState(p)%dotState(startIndex:endIndex,:) dot%crss_back => plasticState(p)%dotState(startIndex:endIndex,:)
plasticState(p)%atol(startIndex:endIndex) = config%getFloat('atol_xi',defaultVal=1.0_pReal) plasticState(p)%atol(startIndex:endIndex) = pl%get_asFloat('atol_xi',defaultVal=1.0_pReal)
startIndex = endIndex + 1 startIndex = endIndex + 1
endIndex = endIndex + prm%sum_N_sl endIndex = endIndex + prm%sum_N_sl
stt%accshear => plasticState(p)%state (startIndex:endIndex,:) stt%accshear => plasticState(p)%state (startIndex:endIndex,:)
dot%accshear => plasticState(p)%dotState(startIndex:endIndex,:) dot%accshear => plasticState(p)%dotState(startIndex:endIndex,:)
plasticState(p)%atol(startIndex:endIndex) = config%getFloat('atol_gamma',defaultVal=1.0e-6_pReal) plasticState(p)%atol(startIndex:endIndex) = pl%get_asFloat('atol_gamma',defaultVal=1.0e-6_pReal)
if(any(plasticState(p)%atol(startIndex:endIndex) < 0.0_pReal)) extmsg = trim(extmsg)//' atol_gamma' if(any(plasticState(p)%atol(startIndex:endIndex) < 0.0_pReal)) extmsg = trim(extmsg)//' atol_gamma'
! global alias ! global alias
plasticState(p)%slipRate => plasticState(p)%dotState(startIndex:endIndex,:) plasticState(p)%slipRate => plasticState(p)%dotState(startIndex:endIndex,:)
@ -212,12 +229,12 @@ module subroutine plastic_kinehardening_init
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! exit if any parameter is out of range ! exit if any parameter is out of range
if (extmsg /= '') call IO_error(211,ext_msg=trim(extmsg)//'('//PLASTICITY_KINEHARDENING_LABEL//')') if (extmsg /= '') call IO_error(211,ext_msg=trim(extmsg)//'(kinehardening)')
enddo enddo
end subroutine plastic_kinehardening_init end function plastic_kinehardening_init
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
@ -364,23 +381,23 @@ module subroutine plastic_kinehardening_results(instance,group)
associate(prm => param(instance), stt => state(instance)) associate(prm => param(instance), stt => state(instance))
outputsLoop: do o = 1,size(prm%output) outputsLoop: do o = 1,size(prm%output)
select case(trim(prm%output(o))) select case(trim(prm%output(o)))
case('resistance') case('xi')
if(prm%sum_N_sl>0) call results_writeDataset(group,stt%crss,'xi_sl', & if(prm%sum_N_sl>0) call results_writeDataset(group,stt%crss,trim(prm%output(o)), &
'resistance against plastic slip','Pa') 'resistance against plastic slip','Pa')
case('backstress') ! ToDo: should be 'tau_back' case('tau_b')
if(prm%sum_N_sl>0) call results_writeDataset(group,stt%crss_back,'tau_back', & if(prm%sum_N_sl>0) call results_writeDataset(group,stt%crss_back,trim(prm%output(o)), &
'back stress against plastic slip','Pa') 'back stress against plastic slip','Pa')
case ('sense') case ('sgn(gamma)')
if(prm%sum_N_sl>0) call results_writeDataset(group,stt%sense,'sense_of_shear', & if(prm%sum_N_sl>0) call results_writeDataset(group,stt%sense,trim(prm%output(o)), & ! ToDo: could be int
'tbd','1') 'tbd','1')
case ('chi0') case ('chi_0')
if(prm%sum_N_sl>0) call results_writeDataset(group,stt%chi0,'chi0', & if(prm%sum_N_sl>0) call results_writeDataset(group,stt%chi0,trim(prm%output(o)), &
'tbd','Pa') 'tbd','Pa')
case ('gamma0') case ('gamma_0')
if(prm%sum_N_sl>0) call results_writeDataset(group,stt%gamma0,'gamma0', & if(prm%sum_N_sl>0) call results_writeDataset(group,stt%gamma0,trim(prm%output(o)), &
'tbd','1') 'tbd','1')
case ('accumulatedshear') case ('gamma')
if(prm%sum_N_sl>0) call results_writeDataset(group,stt%accshear,'gamma_sl', & if(prm%sum_N_sl>0) call results_writeDataset(group,stt%accshear,trim(prm%output(o)), &
'plastic shear','1') 'plastic shear','1')
end select end select
enddo outputsLoop enddo outputsLoop

View File

@ -12,26 +12,40 @@ contains
!> @brief module initialization !> @brief module initialization
!> @details reads in material parameters, allocates arrays, and does sanity checks !> @details reads in material parameters, allocates arrays, and does sanity checks
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
module subroutine plastic_none_init module function plastic_none_init() result(myPlasticity)
logical, dimension(:), allocatable :: myPlasticity
integer :: & integer :: &
Ninstance, & Ninstance, &
p, & p, &
NipcMyPhase NipcMyPhase
class(tNode), pointer :: &
phases, &
phase, &
pl
write(6,'(/,a)') ' <<<+- plastic_'//PLASTICITY_NONE_LABEL//' init -+>>>' write(6,'(/,a)') ' <<<+- plastic_none init -+>>>'
Ninstance = count(phase_plasticity == PLASTICITY_NONE_ID)
write(6,'(a16,1x,i5,/)') '# instances:',Ninstance; flush(6)
do p = 1, size(phase_plasticity)
if (phase_plasticity(p) /= PLASTICITY_NONE_ID) cycle
NipcMyPhase = count(material_phaseAt == p) * discretization_nIP
call material_allocateState(plasticState(p),NipcMyPhase,0,0,0)
phases => material_root%get('phase')
allocate(myPlasticity(phases%length), source = .false. )
do p = 1, phases%length
phase => phases%get(p)
pl => phase%get('plasticity')
if(pl%get_asString('type') == 'none') myPlasticity(p) = .true.
enddo enddo
end subroutine plastic_none_init Ninstance = count(myPlasticity)
write(6,'(a16,1x,i5,/)') '# instances:',Ninstance; flush(6)
if(Ninstance == 0) return
do p = 1, phases%length
phase => phases%get(p)
if(.not. myPlasticity(p)) cycle
NipcMyPhase = count(material_phaseAt == p) * discretization_nIP
call constitutive_allocateState(plasticState(p),NipcMyPhase,0,0,0)
enddo
end function plastic_none_init
end submodule plastic_none end submodule plastic_none

View File

@ -163,11 +163,12 @@ contains
!> @brief module initialization !> @brief module initialization
!> @details reads in material parameters, allocates arrays, and does sanity checks !> @details reads in material parameters, allocates arrays, and does sanity checks
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
module subroutine plastic_nonlocal_init module function plastic_nonlocal_init() result(myPlasticity)
logical, dimension(:), allocatable :: myPlasticity
integer :: & integer :: &
Ninstance, & Ninstance, &
p, & p, i, &
NipcMyPhase, & NipcMyPhase, &
sizeState, sizeDotState, sizeDependentState, sizeDeltaState, & sizeState, sizeDotState, sizeDependentState, sizeDeltaState, &
s1, s2, & s1, s2, &
@ -178,8 +179,12 @@ module subroutine plastic_nonlocal_init
extmsg = '' extmsg = ''
type(tInitialParameters) :: & type(tInitialParameters) :: &
ini ini
class(tNode), pointer :: &
write(6,'(/,a)') ' <<<+- constitutive_'//PLASTICITY_NONLOCAL_LABEL//' init -+>>>' phases, &
phase, &
pl
write(6,'(/,a)') ' <<<+- plastic_nonlocal init -+>>>'
write(6,'(/,a)') ' Reuber et al., Acta Materialia 71:333348, 2014' write(6,'(/,a)') ' Reuber et al., Acta Materialia 71:333348, 2014'
write(6,'(a)') ' https://doi.org/10.1016/j.actamat.2014.03.012' write(6,'(a)') ' https://doi.org/10.1016/j.actamat.2014.03.012'
@ -187,8 +192,15 @@ module subroutine plastic_nonlocal_init
write(6,'(/,a)') ' Kords, Dissertation RWTH Aachen, 2014' write(6,'(/,a)') ' Kords, Dissertation RWTH Aachen, 2014'
write(6,'(a)') ' http://publications.rwth-aachen.de/record/229993' write(6,'(a)') ' http://publications.rwth-aachen.de/record/229993'
Ninstance = count(phase_plasticity == PLASTICITY_NONLOCAL_ID) myPlasticity = plastic_active('nonlocal')
Ninstance = count(myPlasticity)
write(6,'(a16,1x,i5,/)') '# instances:',Ninstance; flush(6) write(6,'(a16,1x,i5,/)') '# instances:',Ninstance; flush(6)
if(Ninstance == 0) then
call geometry_plastic_nonlocal_disable
return
endif
allocate(param(Ninstance)) allocate(param(Ninstance))
allocate(state(Ninstance)) allocate(state(Ninstance))
@ -197,33 +209,43 @@ module subroutine plastic_nonlocal_init
allocate(deltaState(Ninstance)) allocate(deltaState(Ninstance))
allocate(microstructure(Ninstance)) allocate(microstructure(Ninstance))
do p=1, size(config_phase) phases => material_root%get('phase')
if (phase_plasticity(p) /= PLASTICITY_NONLOCAL_ID) cycle i = 0
do p = 1, phases%length
phase => phases%get(p)
associate(prm => param(phase_plasticityInstance(p)), & if(.not. myPlasticity(p)) cycle
dot => dotState(phase_plasticityInstance(p)), & i = i + 1
stt => state(phase_plasticityInstance(p)), & associate(prm => param(i), &
st0 => state0(phase_plasticityInstance(p)), & dot => dotState(i), &
del => deltaState(phase_plasticityInstance(p)), & stt => state(i), &
dst => microstructure(phase_plasticityInstance(p)), & st0 => state0(i), &
config => config_phase(p)) del => deltaState(i), &
dst => microstructure(i))
pl => phase%get('plasticity')
prm%output = config%getStrings('(output)',defaultVal=emptyStringArray) phase_localPlasticity(p) = .not. pl%contains('nonlocal')
prm%atol_rho = config%getFloat('atol_rho',defaultVal=1.0e4_pReal) #if defined (__GFORTRAN__)
prm%output = output_asStrings(pl)
#else
prm%output = pl%get_asStrings('output',defaultVal=emptyStringArray)
#endif
prm%atol_rho = pl%get_asFloat('atol_rho',defaultVal=1.0e4_pReal)
! This data is read in already in lattice ! This data is read in already in lattice
prm%mu = lattice_mu(p) prm%mu = lattice_mu(p)
prm%nu = lattice_nu(p) prm%nu = lattice_nu(p)
ini%N_sl = config%getInts('nslip',defaultVal=emptyIntArray) ini%N_sl = pl%get_asInts('N_sl',defaultVal=emptyIntArray)
prm%sum_N_sl = sum(abs(ini%N_sl)) prm%sum_N_sl = sum(abs(ini%N_sl))
slipActive: if (prm%sum_N_sl > 0) then slipActive: if (prm%sum_N_sl > 0) then
prm%Schmid = lattice_SchmidMatrix_slip(ini%N_sl,config%getString('lattice_structure'),& prm%Schmid = lattice_SchmidMatrix_slip(ini%N_sl,phase%get_asString('lattice'),&
config%getFloat('c/a',defaultVal=0.0_pReal)) phase%get_asFloat('c/a',defaultVal=0.0_pReal))
if(trim(config%getString('lattice_structure')) == 'bcc') then if(trim(phase%get_asString('lattice')) == 'bcc') then
a = config%getFloats('nonschmid_coefficients',defaultVal = emptyRealArray) a = pl%get_asFloats('nonSchmid_coefficients',defaultVal = emptyRealArray)
if(size(a) > 0) prm%nonSchmidActive = .true. if(size(a) > 0) prm%nonSchmidActive = .true.
prm%nonSchmid_pos = lattice_nonSchmidMatrix(ini%N_sl,a,+1) prm%nonSchmid_pos = lattice_nonSchmidMatrix(ini%N_sl,a,+1)
prm%nonSchmid_neg = lattice_nonSchmidMatrix(ini%N_sl,a,-1) prm%nonSchmid_neg = lattice_nonSchmidMatrix(ini%N_sl,a,-1)
@ -233,20 +255,20 @@ module subroutine plastic_nonlocal_init
endif endif
prm%interactionSlipSlip = lattice_interaction_SlipBySlip(ini%N_sl, & prm%interactionSlipSlip = lattice_interaction_SlipBySlip(ini%N_sl, &
config%getFloats('interaction_slipslip'), & pl%get_asFloats('h_sl_sl'), &
config%getString('lattice_structure')) phase%get_asString('lattice'))
prm%forestProjection_edge = lattice_forestProjection_edge (ini%N_sl,config%getString('lattice_structure'),& prm%forestProjection_edge = lattice_forestProjection_edge (ini%N_sl,phase%get_asString('lattice'),&
config%getFloat('c/a',defaultVal=0.0_pReal)) phase%get_asFloat('c/a',defaultVal=0.0_pReal))
prm%forestProjection_screw = lattice_forestProjection_screw(ini%N_sl,config%getString('lattice_structure'),& prm%forestProjection_screw = lattice_forestProjection_screw(ini%N_sl,phase%get_asString('lattice'),&
config%getFloat('c/a',defaultVal=0.0_pReal)) phase%get_asFloat('c/a',defaultVal=0.0_pReal))
prm%slip_direction = lattice_slip_direction (ini%N_sl,config%getString('lattice_structure'),& prm%slip_direction = lattice_slip_direction (ini%N_sl,phase%get_asString('lattice'),&
config%getFloat('c/a',defaultVal=0.0_pReal)) phase%get_asFloat('c/a',defaultVal=0.0_pReal))
prm%slip_transverse = lattice_slip_transverse(ini%N_sl,config%getString('lattice_structure'),& prm%slip_transverse = lattice_slip_transverse(ini%N_sl,phase%get_asString('lattice'),&
config%getFloat('c/a',defaultVal=0.0_pReal)) phase%get_asFloat('c/a',defaultVal=0.0_pReal))
prm%slip_normal = lattice_slip_normal (ini%N_sl,config%getString('lattice_structure'),& prm%slip_normal = lattice_slip_normal (ini%N_sl,phase%get_asString('lattice'),&
config%getFloat('c/a',defaultVal=0.0_pReal)) phase%get_asFloat('c/a',defaultVal=0.0_pReal))
! collinear systems (only for octahedral slip systems in fcc) ! collinear systems (only for octahedral slip systems in fcc)
allocate(prm%colinearSystem(prm%sum_N_sl), source = -1) allocate(prm%colinearSystem(prm%sum_N_sl), source = -1)
@ -258,113 +280,113 @@ module subroutine plastic_nonlocal_init
enddo enddo
enddo enddo
ini%rhoSglEdgePos0 = config%getFloats('rhosgledgepos0', requiredSize=size(ini%N_sl)) ini%rhoSglEdgePos0 = pl%get_asFloats('rho_u_ed_pos_0', requiredSize=size(ini%N_sl))
ini%rhoSglEdgeNeg0 = config%getFloats('rhosgledgeneg0', requiredSize=size(ini%N_sl)) ini%rhoSglEdgeNeg0 = pl%get_asFloats('rho_u_ed_neg_0', requiredSize=size(ini%N_sl))
ini%rhoSglScrewPos0 = config%getFloats('rhosglscrewpos0', requiredSize=size(ini%N_sl)) ini%rhoSglScrewPos0 = pl%get_asFloats('rho_u_sc_pos_0', requiredSize=size(ini%N_sl))
ini%rhoSglScrewNeg0 = config%getFloats('rhosglscrewneg0', requiredSize=size(ini%N_sl)) ini%rhoSglScrewNeg0 = pl%get_asFloats('rho_u_sc_neg_0', requiredSize=size(ini%N_sl))
ini%rhoDipEdge0 = config%getFloats('rhodipedge0', requiredSize=size(ini%N_sl)) ini%rhoDipEdge0 = pl%get_asFloats('rho_d_ed_0', requiredSize=size(ini%N_sl))
ini%rhoDipScrew0 = config%getFloats('rhodipscrew0', requiredSize=size(ini%N_sl)) ini%rhoDipScrew0 = pl%get_asFloats('rho_d_sc_0', requiredSize=size(ini%N_sl))
prm%lambda0 = config%getFloats('lambda0', requiredSize=size(ini%N_sl)) prm%lambda0 = pl%get_asFloats('i_sl', requiredSize=size(ini%N_sl))
prm%burgers = config%getFloats('burgers', requiredSize=size(ini%N_sl)) prm%burgers = pl%get_asFloats('b_sl', requiredSize=size(ini%N_sl))
prm%lambda0 = math_expand(prm%lambda0,ini%N_sl) prm%lambda0 = math_expand(prm%lambda0,ini%N_sl)
prm%burgers = math_expand(prm%burgers,ini%N_sl) prm%burgers = math_expand(prm%burgers,ini%N_sl)
prm%minDipoleHeight_edge = config%getFloats('minimumdipoleheightedge', requiredSize=size(ini%N_sl)) prm%minDipoleHeight_edge = pl%get_asFloats('d_ed', requiredSize=size(ini%N_sl))
prm%minDipoleHeight_screw = config%getFloats('minimumdipoleheightscrew', requiredSize=size(ini%N_sl)) prm%minDipoleHeight_screw = pl%get_asFloats('d_sc', requiredSize=size(ini%N_sl))
prm%minDipoleHeight_edge = math_expand(prm%minDipoleHeight_edge, ini%N_sl) prm%minDipoleHeight_edge = math_expand(prm%minDipoleHeight_edge, ini%N_sl)
prm%minDipoleHeight_screw = math_expand(prm%minDipoleHeight_screw,ini%N_sl) prm%minDipoleHeight_screw = math_expand(prm%minDipoleHeight_screw,ini%N_sl)
allocate(prm%minDipoleHeight(prm%sum_N_sl,2)) allocate(prm%minDipoleHeight(prm%sum_N_sl,2))
prm%minDipoleHeight(:,1) = prm%minDipoleHeight_edge prm%minDipoleHeight(:,1) = prm%minDipoleHeight_edge
prm%minDipoleHeight(:,2) = prm%minDipoleHeight_screw prm%minDipoleHeight(:,2) = prm%minDipoleHeight_screw
prm%peierlsstress_edge = config%getFloats('peierlsstressedge', requiredSize=size(ini%N_sl)) prm%peierlsstress_edge = pl%get_asFloats('tau_peierls_ed', requiredSize=size(ini%N_sl))
prm%peierlsstress_screw = config%getFloats('peierlsstressscrew', requiredSize=size(ini%N_sl)) prm%peierlsstress_screw = pl%get_asFloats('tau_peierls_sc', requiredSize=size(ini%N_sl))
prm%peierlsstress_edge = math_expand(prm%peierlsstress_edge, ini%N_sl) prm%peierlsstress_edge = math_expand(prm%peierlsstress_edge, ini%N_sl)
prm%peierlsstress_screw = math_expand(prm%peierlsstress_screw,ini%N_sl) prm%peierlsstress_screw = math_expand(prm%peierlsstress_screw,ini%N_sl)
allocate(prm%peierlsstress(prm%sum_N_sl,2)) allocate(prm%peierlsstress(prm%sum_N_sl,2))
prm%peierlsstress(:,1) = prm%peierlsstress_edge prm%peierlsstress(:,1) = prm%peierlsstress_edge
prm%peierlsstress(:,2) = prm%peierlsstress_screw prm%peierlsstress(:,2) = prm%peierlsstress_screw
prm%significantRho = config%getFloat('significantrho') prm%significantRho = pl%get_asFloat('rho_significant')
prm%significantN = config%getFloat('significantn', 0.0_pReal) prm%significantN = pl%get_asFloat('rho_num_significant', 0.0_pReal)
prm%CFLfactor = config%getFloat('cflfactor',defaultVal=2.0_pReal) prm%CFLfactor = pl%get_asFloat('f_c',defaultVal=2.0_pReal)
prm%atomicVolume = config%getFloat('atomicvolume') prm%atomicVolume = pl%get_asFloat('V_at')
prm%Dsd0 = config%getFloat('selfdiffusionprefactor') !,'dsd0' prm%Dsd0 = pl%get_asFloat('D_0') !,'dsd0'
prm%selfDiffusionEnergy = config%getFloat('selfdiffusionenergy') !,'qsd' prm%selfDiffusionEnergy = pl%get_asFloat('Q_cl') !,'qsd'
prm%linetensionEffect = config%getFloat('linetension') prm%linetensionEffect = pl%get_asFloat('f_F')
prm%edgeJogFactor = config%getFloat('edgejog')!,'edgejogs' prm%edgeJogFactor = pl%get_asFloat('f_ed') !,'edgejogs'
prm%doublekinkwidth = config%getFloat('doublekinkwidth') prm%doublekinkwidth = pl%get_asFloat('w')
prm%solidSolutionEnergy = config%getFloat('solidsolutionenergy') prm%solidSolutionEnergy = pl%get_asFloat('Q_sol')
prm%solidSolutionSize = config%getFloat('solidsolutionsize') prm%solidSolutionSize = pl%get_asFloat('f_sol')
prm%solidSolutionConcentration = config%getFloat('solidsolutionconcentration') prm%solidSolutionConcentration = pl%get_asFloat('c_sol')
prm%p = config%getFloat('p') prm%p = pl%get_asFloat('p_sl')
prm%q = config%getFloat('q') prm%q = pl%get_asFloat('q_sl')
prm%viscosity = config%getFloat('viscosity') prm%viscosity = pl%get_asFloat('eta')
prm%fattack = config%getFloat('attackfrequency') prm%fattack = pl%get_asFloat('nu_a')
! ToDo: discuss logic ! ToDo: discuss logic
ini%rhoSglScatter = config%getFloat('rhosglscatter') ini%rhoSglScatter = pl%get_asFloat('sigma_rho_u')
ini%rhoSglRandom = config%getFloat('rhosglrandom',0.0_pReal) ini%rhoSglRandom = pl%get_asFloat('random_rho_u',defaultVal= 0.0_pReal)
if (config%keyExists('/rhosglrandom/')) & if (pl%contains('random_rho_u')) &
ini%rhoSglRandomBinning = config%getFloat('rhosglrandombinning',0.0_pReal) !ToDo: useful default? ini%rhoSglRandomBinning = pl%get_asFloat('random_rho_u_binning',defaultVal=0.0_pReal) !ToDo: useful default?
! if (rhoSglRandom(instance) < 0.0_pReal) & ! if (rhoSglRandom(instance) < 0.0_pReal) &
! if (rhoSglRandomBinning(instance) <= 0.0_pReal) & ! if (rhoSglRandomBinning(instance) <= 0.0_pReal) &
prm%surfaceTransmissivity = config%getFloat('surfacetransmissivity',defaultVal=1.0_pReal) prm%surfaceTransmissivity = pl%get_asFloat('chi_surface',defaultVal=1.0_pReal)
prm%grainboundaryTransmissivity = config%getFloat('grainboundarytransmissivity',defaultVal=-1.0_pReal) prm%grainboundaryTransmissivity = pl%get_asFloat('chi_GB', defaultVal=-1.0_pReal)
prm%fEdgeMultiplication = config%getFloat('edgemultiplication') prm%fEdgeMultiplication = pl%get_asFloat('f_ed_mult')
prm%shortRangeStressCorrection = config%keyExists('/shortrangestresscorrection/') prm%shortRangeStressCorrection = pl%get_asBool('short_range_stress_correction', defaultVal = .false.)
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! sanity checks ! sanity checks
if (any(prm%burgers < 0.0_pReal)) extmsg = trim(extmsg)//' burgers' if (any(prm%burgers < 0.0_pReal)) extmsg = trim(extmsg)//' b_sl'
if (any(prm%lambda0 <= 0.0_pReal)) extmsg = trim(extmsg)//' lambda0' if (any(prm%lambda0 <= 0.0_pReal)) extmsg = trim(extmsg)//' i_sl'
if (any(ini%rhoSglEdgePos0 < 0.0_pReal)) extmsg = trim(extmsg)//' rhoSglEdgePos0' if (any(ini%rhoSglEdgePos0 < 0.0_pReal)) extmsg = trim(extmsg)//' rho_u_ed_pos_0'
if (any(ini%rhoSglEdgeNeg0 < 0.0_pReal)) extmsg = trim(extmsg)//' rhoSglEdgeNeg0' if (any(ini%rhoSglEdgeNeg0 < 0.0_pReal)) extmsg = trim(extmsg)//' rho_u_ed_neg_0'
if (any(ini%rhoSglScrewPos0 < 0.0_pReal)) extmsg = trim(extmsg)//' rhoSglScrewPos0' if (any(ini%rhoSglScrewPos0 < 0.0_pReal)) extmsg = trim(extmsg)//' rho_u_sc_pos_0'
if (any(ini%rhoSglScrewNeg0 < 0.0_pReal)) extmsg = trim(extmsg)//' rhoSglScrewNeg0' if (any(ini%rhoSglScrewNeg0 < 0.0_pReal)) extmsg = trim(extmsg)//' rho_u_sc_neg_0'
if (any(ini%rhoDipEdge0 < 0.0_pReal)) extmsg = trim(extmsg)//' rhoDipEdge0' if (any(ini%rhoDipEdge0 < 0.0_pReal)) extmsg = trim(extmsg)//' rho_d_ed_0'
if (any(ini%rhoDipScrew0 < 0.0_pReal)) extmsg = trim(extmsg)//' rhoDipScrew0' if (any(ini%rhoDipScrew0 < 0.0_pReal)) extmsg = trim(extmsg)//' rho_d_sc_0'
if (any(prm%peierlsstress < 0.0_pReal)) extmsg = trim(extmsg)//' peierlsstress' if (any(prm%peierlsstress < 0.0_pReal)) extmsg = trim(extmsg)//' tau_peierls'
if (any(prm%minDipoleHeight < 0.0_pReal)) extmsg = trim(extmsg)//' minDipoleHeight' if (any(prm%minDipoleHeight < 0.0_pReal)) extmsg = trim(extmsg)//' d_ed or d_sc'
if (prm%viscosity <= 0.0_pReal) extmsg = trim(extmsg)//' viscosity' if (prm%viscosity <= 0.0_pReal) extmsg = trim(extmsg)//' eta'
if (prm%selfDiffusionEnergy <= 0.0_pReal) extmsg = trim(extmsg)//' selfDiffusionEnergy' if (prm%selfDiffusionEnergy <= 0.0_pReal) extmsg = trim(extmsg)//' Q_cl'
if (prm%fattack <= 0.0_pReal) extmsg = trim(extmsg)//' fattack' if (prm%fattack <= 0.0_pReal) extmsg = trim(extmsg)//' nu_a'
if (prm%doublekinkwidth <= 0.0_pReal) extmsg = trim(extmsg)//' doublekinkwidth' if (prm%doublekinkwidth <= 0.0_pReal) extmsg = trim(extmsg)//' w'
if (prm%Dsd0 < 0.0_pReal) extmsg = trim(extmsg)//' Dsd0' if (prm%Dsd0 < 0.0_pReal) extmsg = trim(extmsg)//' D_0'
if (prm%atomicVolume <= 0.0_pReal) extmsg = trim(extmsg)//' atomicVolume' ! ToDo: in disloUCLA, the atomic volume is given as a factor if (prm%atomicVolume <= 0.0_pReal) extmsg = trim(extmsg)//' V_at' ! ToDo: in disloTungsten, the atomic volume is given as a factor
if (prm%significantN < 0.0_pReal) extmsg = trim(extmsg)//' significantN' if (prm%significantN < 0.0_pReal) extmsg = trim(extmsg)//' rho_num_significant'
if (prm%significantrho < 0.0_pReal) extmsg = trim(extmsg)//' significantrho' if (prm%significantrho < 0.0_pReal) extmsg = trim(extmsg)//' rho_significant'
if (prm%atol_rho < 0.0_pReal) extmsg = trim(extmsg)//' atol_rho' if (prm%atol_rho < 0.0_pReal) extmsg = trim(extmsg)//' atol_rho'
if (prm%CFLfactor < 0.0_pReal) extmsg = trim(extmsg)//' CFLfactor' if (prm%CFLfactor < 0.0_pReal) extmsg = trim(extmsg)//' f_c'
if (prm%p <= 0.0_pReal .or. prm%p > 1.0_pReal) extmsg = trim(extmsg)//' p' if (prm%p <= 0.0_pReal .or. prm%p > 1.0_pReal) extmsg = trim(extmsg)//' p_sl'
if (prm%q < 1.0_pReal .or. prm%q > 2.0_pReal) extmsg = trim(extmsg)//' q' if (prm%q < 1.0_pReal .or. prm%q > 2.0_pReal) extmsg = trim(extmsg)//' q_sl'
if (prm%linetensionEffect < 0.0_pReal .or. prm%linetensionEffect > 1.0_pReal) & if (prm%linetensionEffect < 0.0_pReal .or. prm%linetensionEffect > 1.0_pReal) &
extmsg = trim(extmsg)//' linetensionEffect' extmsg = trim(extmsg)//' f_F'
if (prm%edgeJogFactor < 0.0_pReal .or. prm%edgeJogFactor > 1.0_pReal) & if (prm%edgeJogFactor < 0.0_pReal .or. prm%edgeJogFactor > 1.0_pReal) &
extmsg = trim(extmsg)//' edgeJogFactor' extmsg = trim(extmsg)//' f_ed'
if (prm%solidSolutionEnergy <= 0.0_pReal) extmsg = trim(extmsg)//' solidSolutionEnergy' if (prm%solidSolutionEnergy <= 0.0_pReal) extmsg = trim(extmsg)//' Q_sol'
if (prm%solidSolutionSize <= 0.0_pReal) extmsg = trim(extmsg)//' solidSolutionSize' if (prm%solidSolutionSize <= 0.0_pReal) extmsg = trim(extmsg)//' f_sol'
if (prm%solidSolutionConcentration <= 0.0_pReal) extmsg = trim(extmsg)//' solidSolutionConcentration' if (prm%solidSolutionConcentration <= 0.0_pReal) extmsg = trim(extmsg)//' c_sol'
if (prm%grainboundaryTransmissivity > 1.0_pReal) extmsg = trim(extmsg)//' grainboundaryTransmissivity' if (prm%grainboundaryTransmissivity > 1.0_pReal) extmsg = trim(extmsg)//' chi_GB'
if (prm%surfaceTransmissivity < 0.0_pReal .or. prm%surfaceTransmissivity > 1.0_pReal) & if (prm%surfaceTransmissivity < 0.0_pReal .or. prm%surfaceTransmissivity > 1.0_pReal) &
extmsg = trim(extmsg)//' surfaceTransmissivity' extmsg = trim(extmsg)//' chi_surface'
if (prm%fEdgeMultiplication < 0.0_pReal .or. prm%fEdgeMultiplication > 1.0_pReal) & if (prm%fEdgeMultiplication < 0.0_pReal .or. prm%fEdgeMultiplication > 1.0_pReal) &
extmsg = trim(extmsg)//' fEdgeMultiplication' extmsg = trim(extmsg)//' f_ed_mult'
endif slipActive endif slipActive
@ -384,14 +406,14 @@ module subroutine plastic_nonlocal_init
'maxDipoleHeightEdge ','maxDipoleHeightScrew' ]) * prm%sum_N_sl !< other dependent state variables that are not updated by microstructure 'maxDipoleHeightEdge ','maxDipoleHeightScrew' ]) * prm%sum_N_sl !< other dependent state variables that are not updated by microstructure
sizeDeltaState = sizeDotState sizeDeltaState = sizeDotState
call material_allocateState(plasticState(p),NipcMyPhase,sizeState,sizeDotState,sizeDeltaState) call constitutive_allocateState(plasticState(p),NipcMyPhase,sizeState,sizeDotState,sizeDeltaState)
plasticState(p)%nonlocal = config%KeyExists('/nonlocal/') plasticState(p)%nonlocal = pl%get_asBool('nonlocal')
if(plasticState(p)%nonlocal .and. .not. allocated(IPneighborhood)) & if(plasticState(p)%nonlocal .and. .not. allocated(IPneighborhood)) &
call IO_error(212,ext_msg='IPneighborhood does not exist') call IO_error(212,ext_msg='IPneighborhood does not exist')
plasticState(p)%offsetDeltaState = 0 ! ToDo: state structure does not follow convention plasticState(p)%offsetDeltaState = 0 ! ToDo: state structure does not follow convention
st0%rho => plasticState(p)%state0 (0*prm%sum_N_sl+1:10*prm%sum_N_sl,:) st0%rho => plasticState(p)%state0 (0*prm%sum_N_sl+1:10*prm%sum_N_sl,:)
stt%rho => plasticState(p)%state (0*prm%sum_N_sl+1:10*prm%sum_N_sl,:) stt%rho => plasticState(p)%state (0*prm%sum_N_sl+1:10*prm%sum_N_sl,:)
@ -458,7 +480,7 @@ module subroutine plastic_nonlocal_init
stt%gamma => plasticState(p)%state (10*prm%sum_N_sl + 1:11*prm%sum_N_sl,1:NipcMyPhase) stt%gamma => plasticState(p)%state (10*prm%sum_N_sl + 1:11*prm%sum_N_sl,1:NipcMyPhase)
dot%gamma => plasticState(p)%dotState (10*prm%sum_N_sl + 1:11*prm%sum_N_sl,1:NipcMyPhase) dot%gamma => plasticState(p)%dotState (10*prm%sum_N_sl + 1:11*prm%sum_N_sl,1:NipcMyPhase)
del%gamma => plasticState(p)%deltaState (10*prm%sum_N_sl + 1:11*prm%sum_N_sl,1:NipcMyPhase) del%gamma => plasticState(p)%deltaState (10*prm%sum_N_sl + 1:11*prm%sum_N_sl,1:NipcMyPhase)
plasticState(p)%atol(10*prm%sum_N_sl+1:11*prm%sum_N_sl ) = config%getFloat('atol_gamma', defaultVal = 1.0e-2_pReal) plasticState(p)%atol(10*prm%sum_N_sl+1:11*prm%sum_N_sl ) = pl%get_asFloat('atol_gamma', defaultVal = 1.0e-2_pReal)
if(any(plasticState(p)%atol(10*prm%sum_N_sl+1:11*prm%sum_N_sl) < 0.0_pReal)) & if(any(plasticState(p)%atol(10*prm%sum_N_sl+1:11*prm%sum_N_sl) < 0.0_pReal)) &
extmsg = trim(extmsg)//' atol_gamma' extmsg = trim(extmsg)//' atol_gamma'
plasticState(p)%slipRate => plasticState(p)%dotState (10*prm%sum_N_sl + 1:11*prm%sum_N_sl,1:NipcMyPhase) plasticState(p)%slipRate => plasticState(p)%dotState (10*prm%sum_N_sl + 1:11*prm%sum_N_sl,1:NipcMyPhase)
@ -474,12 +496,12 @@ module subroutine plastic_nonlocal_init
allocate(dst%tau_back(prm%sum_N_sl,NipcMyPhase),source=0.0_pReal) allocate(dst%tau_back(prm%sum_N_sl,NipcMyPhase),source=0.0_pReal)
end associate end associate
if (NipcMyPhase > 0) call stateInit(ini,p,NipcMyPhase) if (NipcMyPhase > 0) call stateInit(ini,p,NipcMyPhase,i)
plasticState(p)%state0 = plasticState(p)%state plasticState(p)%state0 = plasticState(p)%state
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! exit if any parameter is out of range ! exit if any parameter is out of range
if (extmsg /= '') call IO_error(211,ext_msg=trim(extmsg)//'('//PLASTICITY_NONLOCAL_LABEL//')') if (extmsg /= '') call IO_error(211,ext_msg=trim(extmsg)//'(nonlocal)')
enddo enddo
@ -491,35 +513,39 @@ module subroutine plastic_nonlocal_init
allocate(iV(maxval(param%sum_N_sl),4,Ninstance), source=0) allocate(iV(maxval(param%sum_N_sl),4,Ninstance), source=0)
allocate(iD(maxval(param%sum_N_sl),2,Ninstance), source=0) allocate(iD(maxval(param%sum_N_sl),2,Ninstance), source=0)
initializeInstances: do p = 1, size(phase_plasticity) i = 0
NipcMyPhase = count(material_phaseAt==p) * discretization_nIP do p = 1, phases%length
myPhase2: if (phase_plasticity(p) == PLASTICITY_NONLOCAL_ID) then phase => phases%get(p)
l = 0
do t = 1,4
do s = 1,param(phase_plasticityInstance(p))%sum_N_sl
l = l + 1
iRhoU(s,t,phase_plasticityInstance(p)) = l
enddo
enddo
l = l + (4+2+1+1)*param(phase_plasticityInstance(p))%sum_N_sl ! immobile(4), dipole(2), shear, forest
do t = 1,4
do s = 1,param(phase_plasticityInstance(p))%sum_N_sl
l = l + 1
iV(s,t,phase_plasticityInstance(p)) = l
enddo
enddo
do t = 1,2
do s = 1,param(phase_plasticityInstance(p))%sum_N_sl
l = l + 1
iD(s,t,phase_plasticityInstance(p)) = l
enddo
enddo
if (iD(param(phase_plasticityInstance(p))%sum_N_sl,2,phase_plasticityInstance(p)) /= plasticState(p)%sizeState) &
call IO_error(0, ext_msg = 'state indices not properly set ('//PLASTICITY_NONLOCAL_LABEL//')')
endif myPhase2
enddo initializeInstances
end subroutine plastic_nonlocal_init if(.not. myPlasticity(p)) cycle
i = i + 1
NipcMyPhase = count(material_phaseAt==p) * discretization_nIP
l = 0
do t = 1,4
do s = 1,param(i)%sum_N_sl
l = l + 1
iRhoU(s,t,i) = l
enddo
enddo
l = l + (4+2+1+1)*param(i)%sum_N_sl ! immobile(4), dipole(2), shear, forest
do t = 1,4
do s = 1,param(i)%sum_N_sl
l = l + 1
iV(s,t,i) = l
enddo
enddo
do t = 1,2
do s = 1,param(i)%sum_N_sl
l = l + 1
iD(s,t,i) = l
enddo
enddo
if (iD(param(i)%sum_N_sl,2,i) /= plasticState(p)%sizeState) &
call IO_error(0, ext_msg = 'state indices not properly set (nonlocal)')
enddo
end function plastic_nonlocal_init
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
@ -1447,7 +1473,8 @@ module subroutine plastic_nonlocal_updateCompatibility(orientation,instance,i,e)
elseif (prm%grainboundaryTransmissivity >= 0.0_pReal) then elseif (prm%grainboundaryTransmissivity >= 0.0_pReal) then
!* GRAIN BOUNDARY ! !* GRAIN BOUNDARY !
!* fixed transmissivity for adjacent ips with different texture (only if explicitly given in material.config) !* fixed transmissivity for adjacent ips with different texture (only if explicitly given in material.config)
if (material_texture(1,i,e) /= material_texture(1,neighbor_i,neighbor_e) .and. & if (any(dNeq(material_orientation0(1,i,e)%asQuaternion(), &
material_orientation0(1,neighbor_i,neighbor_e)%asQuaternion())) .and. &
(.not. phase_localPlasticity(neighbor_phase))) & (.not. phase_localPlasticity(neighbor_phase))) &
forall(s1 = 1:ns) my_compatibility(:,s1,s1,n) = sqrt(prm%grainboundaryTransmissivity) forall(s1 = 1:ns) my_compatibility(:,s1,s1,n) = sqrt(prm%grainboundaryTransmissivity)
else else
@ -1514,56 +1541,56 @@ module subroutine plastic_nonlocal_results(instance,group)
associate(prm => param(instance),dst => microstructure(instance),stt=>state(instance)) associate(prm => param(instance),dst => microstructure(instance),stt=>state(instance))
outputsLoop: do o = 1,size(prm%output) outputsLoop: do o = 1,size(prm%output)
select case(trim(prm%output(o))) select case(trim(prm%output(o)))
case('rho_sgl_mob_edg_pos') case('rho_u_ed_pos')
if(prm%sum_N_sl>0) call results_writeDataset(group,stt%rho_sgl_mob_edg_pos, 'rho_sgl_mob_edg_pos', & if(prm%sum_N_sl>0) call results_writeDataset(group,stt%rho_sgl_mob_edg_pos, trim(prm%output(o)), &
'positive mobile edge density','1/m²') 'positive mobile edge density','1/m²')
case('rho_sgl_imm_edg_pos') case('rho_b_ed_pos')
if(prm%sum_N_sl>0) call results_writeDataset(group,stt%rho_sgl_imm_edg_pos, 'rho_sgl_imm_edg_pos',& if(prm%sum_N_sl>0) call results_writeDataset(group,stt%rho_sgl_imm_edg_pos, trim(prm%output(o)), &
'positive immobile edge density','1/m²') 'positive immobile edge density','1/m²')
case('rho_sgl_mob_edg_neg') case('rho_u_ed_neg')
if(prm%sum_N_sl>0) call results_writeDataset(group,stt%rho_sgl_mob_edg_neg, 'rho_sgl_mob_edg_neg',& if(prm%sum_N_sl>0) call results_writeDataset(group,stt%rho_sgl_mob_edg_neg, trim(prm%output(o)), &
'negative mobile edge density','1/m²') 'negative mobile edge density','1/m²')
case('rho_sgl_imm_edg_neg') case('rho_b_ed_neg')
if(prm%sum_N_sl>0) call results_writeDataset(group,stt%rho_sgl_imm_edg_neg, 'rho_sgl_imm_edg_neg',& if(prm%sum_N_sl>0) call results_writeDataset(group,stt%rho_sgl_imm_edg_neg, trim(prm%output(o)), &
'negative immobile edge density','1/m²') 'negative immobile edge density','1/m²')
case('rho_dip_edg') case('rho_d_ed')
if(prm%sum_N_sl>0) call results_writeDataset(group,stt%rho_dip_edg, 'rho_dip_edg',& if(prm%sum_N_sl>0) call results_writeDataset(group,stt%rho_dip_edg, trim(prm%output(o)), &
'edge dipole density','1/m²') 'edge dipole density','1/m²')
case('rho_sgl_mob_scr_pos') case('rho_u_sc_pos')
if(prm%sum_N_sl>0) call results_writeDataset(group,stt%rho_sgl_mob_scr_pos, 'rho_sgl_mob_scr_pos',& if(prm%sum_N_sl>0) call results_writeDataset(group,stt%rho_sgl_mob_scr_pos, trim(prm%output(o)), &
'positive mobile screw density','1/m²') 'positive mobile screw density','1/m²')
case('rho_sgl_imm_scr_pos') case('rho_b_sc_pos')
if(prm%sum_N_sl>0) call results_writeDataset(group,stt%rho_sgl_imm_scr_pos, 'rho_sgl_imm_scr_pos',& if(prm%sum_N_sl>0) call results_writeDataset(group,stt%rho_sgl_imm_scr_pos, trim(prm%output(o)), &
'positive immobile screw density','1/m²') 'positive immobile screw density','1/m²')
case('rho_sgl_mob_scr_neg') case('rho_u_sc_neg')
if(prm%sum_N_sl>0) call results_writeDataset(group,stt%rho_sgl_mob_scr_neg, 'rho_sgl_mob_scr_neg',& if(prm%sum_N_sl>0) call results_writeDataset(group,stt%rho_sgl_mob_scr_neg, trim(prm%output(o)), &
'negative mobile screw density','1/m²') 'negative mobile screw density','1/m²')
case('rho_sgl_imm_scr_neg') case('rho_b_sc_neg')
if(prm%sum_N_sl>0) call results_writeDataset(group,stt%rho_sgl_imm_scr_neg, 'rho_sgl_imm_scr_neg',& if(prm%sum_N_sl>0) call results_writeDataset(group,stt%rho_sgl_imm_scr_neg, trim(prm%output(o)), &
'negative immobile screw density','1/m²') 'negative immobile screw density','1/m²')
case('rho_dip_scr') case('rho_d_sc')
if(prm%sum_N_sl>0) call results_writeDataset(group,stt%rho_dip_scr, 'rho_dip_scr',& if(prm%sum_N_sl>0) call results_writeDataset(group,stt%rho_dip_scr, trim(prm%output(o)), &
'screw dipole density','1/m²') 'screw dipole density','1/m²')
case('rho_forest') case('rho_f')
if(prm%sum_N_sl>0) call results_writeDataset(group,stt%rho_forest, 'rho_forest',& if(prm%sum_N_sl>0) call results_writeDataset(group,stt%rho_forest, trim(prm%output(o)), &
'forest density','1/m²') 'forest density','1/m²')
case('v_edg_pos') case('v_ed_pos')
if(prm%sum_N_sl>0) call results_writeDataset(group,stt%v_edg_pos, 'v_edg_pos',& if(prm%sum_N_sl>0) call results_writeDataset(group,stt%v_edg_pos, trim(prm%output(o)), &
'positive edge velocity','m/s') 'positive edge velocity','m/s')
case('v_edg_neg') case('v_ed_neg')
if(prm%sum_N_sl>0) call results_writeDataset(group,stt%v_edg_neg, 'v_edg_neg',& if(prm%sum_N_sl>0) call results_writeDataset(group,stt%v_edg_neg, trim(prm%output(o)), &
'negative edge velocity','m/s') 'negative edge velocity','m/s')
case('v_scr_pos') case('v_sc_pos')
if(prm%sum_N_sl>0) call results_writeDataset(group,stt%v_scr_pos, 'v_scr_pos',& if(prm%sum_N_sl>0) call results_writeDataset(group,stt%v_scr_pos, trim(prm%output(o)), &
'positive srew velocity','m/s') 'positive srew velocity','m/s')
case('v_scr_neg') case('v_sc_neg')
if(prm%sum_N_sl>0) call results_writeDataset(group,stt%v_scr_neg, 'v_scr_neg',& if(prm%sum_N_sl>0) call results_writeDataset(group,stt%v_scr_neg, trim(prm%output(o)), &
'negative screw velocity','m/s') 'negative screw velocity','m/s')
case('gamma') case('gamma')
if(prm%sum_N_sl>0) call results_writeDataset(group,stt%gamma,'gamma',& if(prm%sum_N_sl>0) call results_writeDataset(group,stt%gamma, trim(prm%output(o)), &
'plastic shear','1') 'plastic shear','1')
case('tau_pass') case('tau_pass')
if(prm%sum_N_sl>0) call results_writeDataset(group,dst%tau_pass,'tau_pass',& if(prm%sum_N_sl>0) call results_writeDataset(group,dst%tau_pass, trim(prm%output(o)), &
'passing stress for slip','Pa') 'passing stress for slip','Pa')
end select end select
enddo outputsLoop enddo outputsLoop
@ -1575,13 +1602,14 @@ end subroutine plastic_nonlocal_results
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
!> @brief populates the initial dislocation density !> @brief populates the initial dislocation density
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
subroutine stateInit(ini,phase,NipcMyPhase) subroutine stateInit(ini,phase,NipcMyPhase,instance)
type(tInitialParameters) :: & type(tInitialParameters) :: &
ini ini
integer,intent(in) :: & integer,intent(in) :: &
phase, & phase, &
NipcMyPhase NipcMyPhase, &
instance
integer :: & integer :: &
e, & e, &
i, & i, &
@ -1589,7 +1617,6 @@ subroutine stateInit(ini,phase,NipcMyPhase)
from, & from, &
upto, & upto, &
s, & s, &
instance, &
phasemember phasemember
real(pReal), dimension(2) :: & real(pReal), dimension(2) :: &
noise, & noise, &
@ -1602,7 +1629,7 @@ subroutine stateInit(ini,phase,NipcMyPhase)
real(pReal), dimension(NipcMyPhase) :: & real(pReal), dimension(NipcMyPhase) :: &
volume volume
instance = phase_plasticityInstance(phase)
associate(stt => state(instance)) associate(stt => state(instance))
if (ini%rhoSglRandom > 0.0_pReal) then ! randomly distribute dislocation segments on random slip system and of random type in the volume if (ini%rhoSglRandom > 0.0_pReal) then ! randomly distribute dislocation segments on random slip system and of random type in the volume

View File

@ -66,8 +66,9 @@ contains
!> @brief Perform module initialization. !> @brief Perform module initialization.
!> @details reads in material parameters, allocates arrays, and does sanity checks !> @details reads in material parameters, allocates arrays, and does sanity checks
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
module subroutine plastic_phenopowerlaw_init module function plastic_phenopowerlaw_init() result(myPlasticity)
logical, dimension(:), allocatable :: myPlasticity
integer :: & integer :: &
Ninstance, & Ninstance, &
p, i, & p, i, &
@ -82,33 +83,46 @@ module subroutine plastic_phenopowerlaw_init
a !< non-Schmid coefficients a !< non-Schmid coefficients
character(len=pStringLen) :: & character(len=pStringLen) :: &
extmsg = '' extmsg = ''
class(tNode), pointer :: &
phases, &
phase, &
pl
write(6,'(/,a)') ' <<<+- plastic_'//PLASTICITY_PHENOPOWERLAW_LABEL//' init -+>>>' write(6,'(/,a)') ' <<<+- plastic_phenopowerlaw init -+>>>'
Ninstance = count(phase_plasticity == PLASTICITY_PHENOPOWERLAW_ID)
myPlasticity = plastic_active('phenopowerlaw')
Ninstance = count(myPlasticity)
write(6,'(a16,1x,i5,/)') '# instances:',Ninstance; flush(6) write(6,'(a16,1x,i5,/)') '# instances:',Ninstance; flush(6)
if(Ninstance == 0) return
allocate(param(Ninstance)) allocate(param(Ninstance))
allocate(state(Ninstance)) allocate(state(Ninstance))
allocate(dotState(Ninstance)) allocate(dotState(Ninstance))
do p = 1, size(phase_plasticity) phases => material_root%get('phase')
if (phase_plasticity(p) /= PLASTICITY_PHENOPOWERLAW_ID) cycle i = 0
associate(prm => param(phase_plasticityInstance(p)), & do p = 1, phases%length
dot => dotState(phase_plasticityInstance(p)), & phase => phases%get(p)
stt => state(phase_plasticityInstance(p)), &
config => config_phase(p)) if(.not. myPlasticity(p)) cycle
i = i + 1
associate(prm => param(i), &
dot => dotState(i), &
stt => state(i))
pl => phase%get('plasticity')
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! slip related parameters ! slip related parameters
N_sl = config%getInts('nslip',defaultVal=emptyIntArray) N_sl = pl%get_asInts('N_sl',defaultVal=emptyIntArray)
prm%sum_N_sl = sum(abs(N_sl)) prm%sum_N_sl = sum(abs(N_sl))
slipActive: if (prm%sum_N_sl > 0) then slipActive: if (prm%sum_N_sl > 0) then
prm%P_sl = lattice_SchmidMatrix_slip(N_sl,config%getString('lattice_structure'),& prm%P_sl = lattice_SchmidMatrix_slip(N_sl,phase%get_asString('lattice'),&
config%getFloat('c/a',defaultVal=0.0_pReal)) phase%get_asFloat('c/a',defaultVal=0.0_pReal))
if(trim(config%getString('lattice_structure')) == 'bcc') then if(phase%get_asString('lattice') == 'bcc') then
a = config%getFloats('nonschmid_coefficients',defaultVal = emptyRealArray) a = pl%get_asFloats('nonSchmid_coefficients',defaultVal=emptyRealArray)
if(size(a) > 0) prm%nonSchmidActive = .true. if(size(a) > 0) prm%nonSchmidActive = .true.
prm%nonSchmid_pos = lattice_nonSchmidMatrix(N_sl,a,+1) prm%nonSchmid_pos = lattice_nonSchmidMatrix(N_sl,a,+1)
prm%nonSchmid_neg = lattice_nonSchmidMatrix(N_sl,a,-1) prm%nonSchmid_neg = lattice_nonSchmidMatrix(N_sl,a,-1)
@ -117,18 +131,18 @@ module subroutine plastic_phenopowerlaw_init
prm%nonSchmid_neg = prm%P_sl prm%nonSchmid_neg = prm%P_sl
endif endif
prm%interaction_SlipSlip = lattice_interaction_SlipBySlip(N_sl, & prm%interaction_SlipSlip = lattice_interaction_SlipBySlip(N_sl, &
config%getFloats('interaction_slipslip'), & pl%get_asFloats('h_sl_sl'), &
config%getString('lattice_structure')) phase%get_asString('lattice'))
xi_slip_0 = config%getFloats('tau0_slip', requiredSize=size(N_sl)) xi_slip_0 = pl%get_asFloats('xi_0_sl', requiredSize=size(N_sl))
prm%xi_slip_sat = config%getFloats('tausat_slip', requiredSize=size(N_sl)) prm%xi_slip_sat = pl%get_asFloats('xi_inf_sl', requiredSize=size(N_sl))
prm%H_int = config%getFloats('h_int', requiredSize=size(N_sl), & prm%H_int = pl%get_asFloats('h_int', requiredSize=size(N_sl), &
defaultVal=[(0.0_pReal,i=1,size(N_sl))]) defaultVal=[(0.0_pReal,i=1,size(N_sl))])
prm%gdot0_slip = config%getFloat('gdot0_slip') prm%gdot0_slip = pl%get_asFloat('dot_gamma_0_sl')
prm%n_slip = config%getFloat('n_slip') prm%n_slip = pl%get_asFloat('n_sl')
prm%a_slip = config%getFloat('a_slip') prm%a_slip = pl%get_asFloat('a_sl')
prm%h0_SlipSlip = config%getFloat('h0_slipslip') prm%h0_SlipSlip = pl%get_asFloat('h_0_sl_sl')
! expand: family => system ! expand: family => system
xi_slip_0 = math_expand(xi_slip_0, N_sl) xi_slip_0 = math_expand(xi_slip_0, N_sl)
@ -136,11 +150,11 @@ module subroutine plastic_phenopowerlaw_init
prm%H_int = math_expand(prm%H_int, N_sl) prm%H_int = math_expand(prm%H_int, N_sl)
! sanity checks ! sanity checks
if ( prm%gdot0_slip <= 0.0_pReal) extmsg = trim(extmsg)//' gdot0_slip' if ( prm%gdot0_slip <= 0.0_pReal) extmsg = trim(extmsg)//' dot_gamma_0_sl'
if ( prm%a_slip <= 0.0_pReal) extmsg = trim(extmsg)//' a_slip' if ( prm%a_slip <= 0.0_pReal) extmsg = trim(extmsg)//' a_sl'
if ( prm%n_slip <= 0.0_pReal) extmsg = trim(extmsg)//' n_slip' if ( prm%n_slip <= 0.0_pReal) extmsg = trim(extmsg)//' n_sl'
if (any(xi_slip_0 <= 0.0_pReal)) extmsg = trim(extmsg)//' xi_slip_0' if (any(xi_slip_0 <= 0.0_pReal)) extmsg = trim(extmsg)//' xi_0_sl'
if (any(prm%xi_slip_sat <= 0.0_pReal)) extmsg = trim(extmsg)//' xi_slip_sat' if (any(prm%xi_slip_sat <= 0.0_pReal)) extmsg = trim(extmsg)//' xi_inf_sl'
else slipActive else slipActive
xi_slip_0 = emptyRealArray xi_slip_0 = emptyRealArray
@ -150,34 +164,34 @@ module subroutine plastic_phenopowerlaw_init
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! twin related parameters ! twin related parameters
N_tw = config%getInts('ntwin', defaultVal=emptyIntArray) N_tw = pl%get_asInts('N_tw', defaultVal=emptyIntArray)
prm%sum_N_tw = sum(abs(N_tw)) prm%sum_N_tw = sum(abs(N_tw))
twinActive: if (prm%sum_N_tw > 0) then twinActive: if (prm%sum_N_tw > 0) then
prm%P_tw = lattice_SchmidMatrix_twin(N_tw,config%getString('lattice_structure'),& prm%P_tw = lattice_SchmidMatrix_twin(N_tw,phase%get_asString('lattice'),&
config%getFloat('c/a',defaultVal=0.0_pReal)) phase%get_asFloat('c/a',defaultVal=0.0_pReal))
prm%interaction_TwinTwin = lattice_interaction_TwinByTwin(N_tw,& prm%interaction_TwinTwin = lattice_interaction_TwinByTwin(N_tw,&
config%getFloats('interaction_twintwin'), & pl%get_asFloats('h_tw_tw'), &
config%getString('lattice_structure')) phase%get_asString('lattice'))
prm%gamma_twin_char = lattice_characteristicShear_twin(N_tw,config%getString('lattice_structure'),& prm%gamma_twin_char = lattice_characteristicShear_twin(N_tw,phase%get_asString('lattice'),&
config%getFloat('c/a',defaultVal=0.0_pReal)) phase%get_asFloat('c/a',defaultVal=0.0_pReal))
xi_twin_0 = config%getFloats('tau0_twin',requiredSize=size(N_tw)) xi_twin_0 = pl%get_asFloats('xi_0_tw',requiredSize=size(N_tw))
prm%c_1 = config%getFloat('twin_c',defaultVal=0.0_pReal) prm%c_1 = pl%get_asFloat('c_1',defaultVal=0.0_pReal)
prm%c_2 = config%getFloat('twin_b',defaultVal=1.0_pReal) prm%c_2 = pl%get_asFloat('c_2',defaultVal=1.0_pReal)
prm%c_3 = config%getFloat('twin_e',defaultVal=0.0_pReal) prm%c_3 = pl%get_asFloat('c_3',defaultVal=0.0_pReal)
prm%c_4 = config%getFloat('twin_d',defaultVal=0.0_pReal) prm%c_4 = pl%get_asFloat('c_4',defaultVal=0.0_pReal)
prm%gdot0_twin = config%getFloat('gdot0_twin') prm%gdot0_twin = pl%get_asFloat('dot_gamma_0_tw')
prm%n_twin = config%getFloat('n_twin') prm%n_twin = pl%get_asFloat('n_tw')
prm%spr = config%getFloat('s_pr') prm%spr = pl%get_asFloat('f_sl_sat_tw')
prm%h0_TwinTwin = config%getFloat('h0_twintwin') prm%h0_TwinTwin = pl%get_asFloat('h_0_tw_tw')
! expand: family => system ! expand: family => system
xi_twin_0 = math_expand(xi_twin_0,N_tw) xi_twin_0 = math_expand(xi_twin_0,N_tw)
! sanity checks ! sanity checks
if (prm%gdot0_twin <= 0.0_pReal) extmsg = trim(extmsg)//' gdot0_twin' if (prm%gdot0_twin <= 0.0_pReal) extmsg = trim(extmsg)//' dot_gamma_0_tw'
if (prm%n_twin <= 0.0_pReal) extmsg = trim(extmsg)//' n_twin' if (prm%n_twin <= 0.0_pReal) extmsg = trim(extmsg)//' n_tw'
else twinActive else twinActive
xi_twin_0 = emptyRealArray xi_twin_0 = emptyRealArray
@ -188,13 +202,13 @@ module subroutine plastic_phenopowerlaw_init
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! slip-twin related parameters ! slip-twin related parameters
slipAndTwinActive: if (prm%sum_N_sl > 0 .and. prm%sum_N_tw > 0) then slipAndTwinActive: if (prm%sum_N_sl > 0 .and. prm%sum_N_tw > 0) then
prm%h0_TwinSlip = config%getFloat('h0_twinslip') prm%h0_TwinSlip = pl%get_asFloat('h_0_tw_sl')
prm%interaction_SlipTwin = lattice_interaction_SlipByTwin(N_sl,N_tw,& prm%interaction_SlipTwin = lattice_interaction_SlipByTwin(N_sl,N_tw,&
config%getFloats('interaction_sliptwin'), & pl%get_asFloats('h_sl_tw'), &
config%getString('lattice_structure')) phase%get_asString('lattice'))
prm%interaction_TwinSlip = lattice_interaction_TwinBySlip(N_tw,N_sl,& prm%interaction_TwinSlip = lattice_interaction_TwinBySlip(N_tw,N_sl,&
config%getFloats('interaction_twinslip'), & pl%get_asFloats('h_tw_sl'), &
config%getString('lattice_structure')) phase%get_asString('lattice'))
else slipAndTwinActive else slipAndTwinActive
allocate(prm%interaction_SlipTwin(prm%sum_N_sl,prm%sum_N_tw)) ! at least one dimension is 0 allocate(prm%interaction_SlipTwin(prm%sum_N_sl,prm%sum_N_tw)) ! at least one dimension is 0
allocate(prm%interaction_TwinSlip(prm%sum_N_tw,prm%sum_N_sl)) ! at least one dimension is 0 allocate(prm%interaction_TwinSlip(prm%sum_N_tw,prm%sum_N_sl)) ! at least one dimension is 0
@ -203,7 +217,12 @@ module subroutine plastic_phenopowerlaw_init
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! output pararameters ! output pararameters
prm%output = config%getStrings('(output)',defaultVal=emptyStringArray)
#if defined (__GFORTRAN__)
prm%output = output_asStrings(pl)
#else
prm%output = pl%get_asStrings('output',defaultVal=emptyStringArray)
#endif
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! allocate state arrays ! allocate state arrays
@ -212,7 +231,8 @@ module subroutine plastic_phenopowerlaw_init
+ size(['xi_tw ','gamma_tw']) * prm%sum_N_tw + size(['xi_tw ','gamma_tw']) * prm%sum_N_tw
sizeState = sizeDotState sizeState = sizeDotState
call material_allocateState(plasticState(p),NipcMyPhase,sizeState,sizeDotState,0)
call constitutive_allocateState(plasticState(p),NipcMyPhase,sizeState,sizeDotState,0)
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! state aliases and initialization ! state aliases and initialization
@ -221,7 +241,7 @@ module subroutine plastic_phenopowerlaw_init
stt%xi_slip => plasticState(p)%state (startIndex:endIndex,:) stt%xi_slip => plasticState(p)%state (startIndex:endIndex,:)
stt%xi_slip = spread(xi_slip_0, 2, NipcMyPhase) stt%xi_slip = spread(xi_slip_0, 2, NipcMyPhase)
dot%xi_slip => plasticState(p)%dotState(startIndex:endIndex,:) dot%xi_slip => plasticState(p)%dotState(startIndex:endIndex,:)
plasticState(p)%atol(startIndex:endIndex) = config%getFloat('atol_xi',defaultVal=1.0_pReal) plasticState(p)%atol(startIndex:endIndex) = pl%get_asFloat('atol_xi',defaultVal=1.0_pReal)
if(any(plasticState(p)%atol(startIndex:endIndex) < 0.0_pReal)) extmsg = trim(extmsg)//' atol_xi' if(any(plasticState(p)%atol(startIndex:endIndex) < 0.0_pReal)) extmsg = trim(extmsg)//' atol_xi'
startIndex = endIndex + 1 startIndex = endIndex + 1
@ -229,14 +249,14 @@ module subroutine plastic_phenopowerlaw_init
stt%xi_twin => plasticState(p)%state (startIndex:endIndex,:) stt%xi_twin => plasticState(p)%state (startIndex:endIndex,:)
stt%xi_twin = spread(xi_twin_0, 2, NipcMyPhase) stt%xi_twin = spread(xi_twin_0, 2, NipcMyPhase)
dot%xi_twin => plasticState(p)%dotState(startIndex:endIndex,:) dot%xi_twin => plasticState(p)%dotState(startIndex:endIndex,:)
plasticState(p)%atol(startIndex:endIndex) = config%getFloat('atol_xi',defaultVal=1.0_pReal) plasticState(p)%atol(startIndex:endIndex) = pl%get_asFloat('atol_xi',defaultVal=1.0_pReal)
if(any(plasticState(p)%atol(startIndex:endIndex) < 0.0_pReal)) extmsg = trim(extmsg)//' atol_xi' if(any(plasticState(p)%atol(startIndex:endIndex) < 0.0_pReal)) extmsg = trim(extmsg)//' atol_xi'
startIndex = endIndex + 1 startIndex = endIndex + 1
endIndex = endIndex + prm%sum_N_sl endIndex = endIndex + prm%sum_N_sl
stt%gamma_slip => plasticState(p)%state (startIndex:endIndex,:) stt%gamma_slip => plasticState(p)%state (startIndex:endIndex,:)
dot%gamma_slip => plasticState(p)%dotState(startIndex:endIndex,:) dot%gamma_slip => plasticState(p)%dotState(startIndex:endIndex,:)
plasticState(p)%atol(startIndex:endIndex) = config%getFloat('atol_gamma',defaultVal=1.0e-6_pReal) plasticState(p)%atol(startIndex:endIndex) = pl%get_asFloat('atol_gamma',defaultVal=1.0e-6_pReal)
if(any(plasticState(p)%atol(startIndex:endIndex) < 0.0_pReal)) extmsg = trim(extmsg)//' atol_gamma' if(any(plasticState(p)%atol(startIndex:endIndex) < 0.0_pReal)) extmsg = trim(extmsg)//' atol_gamma'
! global alias ! global alias
plasticState(p)%slipRate => plasticState(p)%dotState(startIndex:endIndex,:) plasticState(p)%slipRate => plasticState(p)%dotState(startIndex:endIndex,:)
@ -245,7 +265,7 @@ module subroutine plastic_phenopowerlaw_init
endIndex = endIndex + prm%sum_N_tw endIndex = endIndex + prm%sum_N_tw
stt%gamma_twin => plasticState(p)%state (startIndex:endIndex,:) stt%gamma_twin => plasticState(p)%state (startIndex:endIndex,:)
dot%gamma_twin => plasticState(p)%dotState(startIndex:endIndex,:) dot%gamma_twin => plasticState(p)%dotState(startIndex:endIndex,:)
plasticState(p)%atol(startIndex:endIndex) = config%getFloat('atol_gamma',defaultVal=1.0e-6_pReal) plasticState(p)%atol(startIndex:endIndex) = pl%get_asFloat('atol_gamma',defaultVal=1.0e-6_pReal)
if(any(plasticState(p)%atol(startIndex:endIndex) < 0.0_pReal)) extmsg = trim(extmsg)//' atol_gamma' if(any(plasticState(p)%atol(startIndex:endIndex) < 0.0_pReal)) extmsg = trim(extmsg)//' atol_gamma'
plasticState(p)%state0 = plasticState(p)%state ! ToDo: this could be done centrally plasticState(p)%state0 = plasticState(p)%state ! ToDo: this could be done centrally
@ -254,11 +274,11 @@ module subroutine plastic_phenopowerlaw_init
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! exit if any parameter is out of range ! exit if any parameter is out of range
if (extmsg /= '') call IO_error(211,ext_msg=trim(extmsg)//'('//PLASTICITY_PHENOPOWERLAW_LABEL//')') if (extmsg /= '') call IO_error(211,ext_msg=trim(extmsg)//'(phenopowerlaw)')
enddo enddo
end subroutine plastic_phenopowerlaw_init end function plastic_phenopowerlaw_init
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
@ -384,18 +404,18 @@ module subroutine plastic_phenopowerlaw_results(instance,group)
outputsLoop: do o = 1,size(prm%output) outputsLoop: do o = 1,size(prm%output)
select case(trim(prm%output(o))) select case(trim(prm%output(o)))
case('resistance_slip') case('xi_sl')
if(prm%sum_N_sl>0) call results_writeDataset(group,stt%xi_slip, 'xi_sl', & if(prm%sum_N_sl>0) call results_writeDataset(group,stt%xi_slip, trim(prm%output(o)), &
'resistance against plastic slip','Pa') 'resistance against plastic slip','Pa')
case('accumulatedshear_slip') case('gamma_sl')
if(prm%sum_N_sl>0) call results_writeDataset(group,stt%gamma_slip,'gamma_sl', & if(prm%sum_N_sl>0) call results_writeDataset(group,stt%gamma_slip,trim(prm%output(o)), &
'plastic shear','1') 'plastic shear','1')
case('resistance_twin') case('xi_tw')
if(prm%sum_N_tw>0) call results_writeDataset(group,stt%xi_twin, 'xi_tw', & if(prm%sum_N_tw>0) call results_writeDataset(group,stt%xi_twin, trim(prm%output(o)), &
'resistance against twinning','Pa') 'resistance against twinning','Pa')
case('accumulatedshear_twin') case('gamma_tw')
if(prm%sum_N_tw>0) call results_writeDataset(group,stt%gamma_twin,'gamma_tw', & if(prm%sum_N_tw>0) call results_writeDataset(group,stt%gamma_twin,trim(prm%output(o)), &
'twinning shear','1') 'twinning shear','1')
end select end select

View File

@ -5,14 +5,20 @@ submodule(constitutive) constitutive_thermal
interface interface
module subroutine source_thermal_dissipation_init module function source_thermal_dissipation_init(source_length) result(mySources)
end subroutine source_thermal_dissipation_init integer, intent(in) :: source_length
logical, dimension(:,:), allocatable :: mySources
end function source_thermal_dissipation_init
module function source_thermal_externalheat_init(source_length) result(mySources)
integer, intent(in) :: source_length
logical, dimension(:,:), allocatable :: mySources
end function source_thermal_externalheat_init
module subroutine source_thermal_externalheat_init module function kinematics_thermal_expansion_init(kinematics_length) result(myKinematics)
end subroutine source_thermal_externalheat_init integer, intent(in) :: kinematics_length
logical, dimension(:,:), allocatable :: myKinematics
module subroutine kinematics_thermal_expansion_init end function kinematics_thermal_expansion_init
end subroutine kinematics_thermal_expansion_init
module subroutine source_thermal_dissipation_getRateAndItsTangent(TDot, dTDot_dT, Tstar, Lp, phase) module subroutine source_thermal_dissipation_getRateAndItsTangent(TDot, dTDot_dT, Tstar, Lp, phase)
@ -46,12 +52,15 @@ contains
module subroutine thermal_init module subroutine thermal_init
! initialize source mechanisms ! initialize source mechanisms
if (any(phase_source == SOURCE_thermal_dissipation_ID)) call source_thermal_dissipation_init if(maxval(phase_Nsources) /= 0) then
if (any(phase_source == SOURCE_thermal_externalheat_ID)) call source_thermal_externalheat_init where(source_thermal_dissipation_init (maxval(phase_Nsources))) phase_source = SOURCE_thermal_dissipation_ID
where(source_thermal_externalheat_init(maxval(phase_Nsources))) phase_source = SOURCE_thermal_externalheat_ID
endif
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
!initialize kinematic mechanisms !initialize kinematic mechanisms
if (any(phase_kinematics == KINEMATICS_thermal_expansion_ID)) call kinematics_thermal_expansion_init if(maxval(phase_Nkinematics) /= 0) where(kinematics_thermal_expansion_init(maxval(phase_Nkinematics))) &
phase_kinematics = KINEMATICS_thermal_expansion_ID
end subroutine thermal_init end subroutine thermal_init

View File

@ -14,7 +14,6 @@ module crystallite
use HDF5_utilities use HDF5_utilities
use DAMASK_interface use DAMASK_interface
use config use config
use debug
use rotations use rotations
use math use math
use FEsolving use FEsolving
@ -143,7 +142,10 @@ subroutine crystallite_init
class(tNode), pointer :: & class(tNode), pointer :: &
num_crystallite, & num_crystallite, &
debug_crystallite ! pointer to debug options for crystallite debug_crystallite, & ! pointer to debug options for crystallite
phases, &
phase, &
generic_param
write(6,'(/,a)') ' <<<+- crystallite init -+>>>' write(6,'(/,a)') ' <<<+- crystallite init -+>>>'
@ -233,19 +235,19 @@ subroutine crystallite_init
call IO_error(301,ext_msg='integrator') call IO_error(301,ext_msg='integrator')
end select end select
allocate(output_constituent(size(config_phase))) phases => material_root%get('phase')
do c = 1, size(config_phase)
allocate(output_constituent(phases%length))
do c = 1, phases%length
phase => phases%get(c)
generic_param => phase%get('generic',defaultVal = emptyDict)
#if defined(__GFORTRAN__) #if defined(__GFORTRAN__)
allocate(output_constituent(c)%label(1)) output_constituent(c)%label = output_asStrings(generic_param)
output_constituent(c)%label(1)= 'GfortranBug86277'
output_constituent(c)%label = config_phase(c)%getStrings('(output)',defaultVal=output_constituent(c)%label )
if (output_constituent(c)%label (1) == 'GfortranBug86277') output_constituent(c)%label = [character(len=pStringLen)::]
#else #else
output_constituent(c)%label = config_phase(c)%getStrings('(output)',defaultVal=[character(len=pStringLen)::]) output_constituent(c)%label = generic_param%get_asStrings('output',defaultVal=emptyStringArray)
#endif #endif
enddo enddo
call config_deallocate('material.config/phase')
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! initialize ! initialize
@ -681,46 +683,46 @@ subroutine crystallite_results
type(rotation), allocatable, dimension(:) :: selected_rotations type(rotation), allocatable, dimension(:) :: selected_rotations
character(len=pStringLen) :: group,structureLabel character(len=pStringLen) :: group,structureLabel
do p=1,size(config_name_phase) do p=1,size(material_name_phase)
group = trim('current/constituent')//'/'//trim(config_name_phase(p))//'/generic' group = trim('current/constituent')//'/'//trim(material_name_phase(p))//'/generic'
call results_closeGroup(results_addGroup(group)) call results_closeGroup(results_addGroup(group))
do o = 1, size(output_constituent(p)%label) do o = 1, size(output_constituent(p)%label)
select case (output_constituent(p)%label(o)) select case (output_constituent(p)%label(o))
case('f') case('F')
selected_tensors = select_tensors(crystallite_partionedF,p) selected_tensors = select_tensors(crystallite_partionedF,p)
call results_writeDataset(group,selected_tensors,'F',& call results_writeDataset(group,selected_tensors,output_constituent(p)%label(o),&
'deformation gradient','1') 'deformation gradient','1')
case('fe') case('Fe')
selected_tensors = select_tensors(crystallite_Fe,p) selected_tensors = select_tensors(crystallite_Fe,p)
call results_writeDataset(group,selected_tensors,'Fe',& call results_writeDataset(group,selected_tensors,output_constituent(p)%label(o),&
'elastic deformation gradient','1') 'elastic deformation gradient','1')
case('fp') case('Fp')
selected_tensors = select_tensors(crystallite_Fp,p) selected_tensors = select_tensors(crystallite_Fp,p)
call results_writeDataset(group,selected_tensors,'Fp',& call results_writeDataset(group,selected_tensors,output_constituent(p)%label(o),&
'plastic deformation gradient','1') 'plastic deformation gradient','1')
case('fi') case('Fi')
selected_tensors = select_tensors(crystallite_Fi,p) selected_tensors = select_tensors(crystallite_Fi,p)
call results_writeDataset(group,selected_tensors,'Fi',& call results_writeDataset(group,selected_tensors,output_constituent(p)%label(o),&
'inelastic deformation gradient','1') 'inelastic deformation gradient','1')
case('lp') case('Lp')
selected_tensors = select_tensors(crystallite_Lp,p) selected_tensors = select_tensors(crystallite_Lp,p)
call results_writeDataset(group,selected_tensors,'Lp',& call results_writeDataset(group,selected_tensors,output_constituent(p)%label(o),&
'plastic velocity gradient','1/s') 'plastic velocity gradient','1/s')
case('li') case('Li')
selected_tensors = select_tensors(crystallite_Li,p) selected_tensors = select_tensors(crystallite_Li,p)
call results_writeDataset(group,selected_tensors,'Li',& call results_writeDataset(group,selected_tensors,output_constituent(p)%label(o),&
'inelastic velocity gradient','1/s') 'inelastic velocity gradient','1/s')
case('p') case('P')
selected_tensors = select_tensors(crystallite_P,p) selected_tensors = select_tensors(crystallite_P,p)
call results_writeDataset(group,selected_tensors,'P',& call results_writeDataset(group,selected_tensors,output_constituent(p)%label(o),&
'First Piola-Kirchhoff stress','Pa') 'First Piola-Kirchoff stress','Pa')
case('s') case('S')
selected_tensors = select_tensors(crystallite_S,p) selected_tensors = select_tensors(crystallite_S,p)
call results_writeDataset(group,selected_tensors,'S',& call results_writeDataset(group,selected_tensors,output_constituent(p)%label(o),&
'Second Piola-Kirchhoff stress','Pa') 'Second Piola-Kirchoff stress','Pa')
case('orientation') case('O')
select case(lattice_structure(p)) select case(lattice_structure(p))
case(lattice_ISO_ID) case(lattice_ISO_ID)
structureLabel = 'iso' structureLabel = 'iso'
@ -736,7 +738,7 @@ subroutine crystallite_results
structureLabel = 'ort' structureLabel = 'ort'
end select end select
selected_rotations = select_rotations(crystallite_orientation,p) selected_rotations = select_rotations(crystallite_orientation,p)
call results_writeDataset(group,selected_rotations,'orientation',& call results_writeDataset(group,selected_rotations,output_constituent(p)%label(o),&
'crystal orientation as quaternion',structureLabel) 'crystal orientation as quaternion',structureLabel)
end select end select
enddo enddo
@ -1575,7 +1577,7 @@ subroutine crystallite_restartWrite
call HDF5_write(fileHandle,crystallite_S, 'S') call HDF5_write(fileHandle,crystallite_S, 'S')
groupHandle = HDF5_addGroup(fileHandle,'constituent') groupHandle = HDF5_addGroup(fileHandle,'constituent')
do i = 1,size(phase_plasticity) do i = 1,size(material_name_phase)
write(datasetName,'(i0,a)') i,'_omega_plastic' write(datasetName,'(i0,a)') i,'_omega_plastic'
call HDF5_write(groupHandle,plasticState(i)%state,datasetName) call HDF5_write(groupHandle,plasticState(i)%state,datasetName)
enddo enddo
@ -1616,7 +1618,7 @@ subroutine crystallite_restartRead
call HDF5_read(fileHandle,crystallite_S0, 'S') call HDF5_read(fileHandle,crystallite_S0, 'S')
groupHandle = HDF5_openGroup(fileHandle,'constituent') groupHandle = HDF5_openGroup(fileHandle,'constituent')
do i = 1,size(phase_plasticity) do i = 1,size(material_name_phase)
write(datasetName,'(i0,a)') i,'_omega_plastic' write(datasetName,'(i0,a)') i,'_omega_plastic'
call HDF5_read(groupHandle,plasticState(i)%state0,datasetName) call HDF5_read(groupHandle,plasticState(i)%state0,datasetName)
enddo enddo

View File

@ -7,7 +7,6 @@ module damage_local
use IO use IO
use material use material
use config use config
use numerics
use YAML_types use YAML_types
use constitutive use constitutive
use results use results
@ -44,9 +43,13 @@ contains
subroutine damage_local_init subroutine damage_local_init
integer :: Ninstance,NofMyHomog,h integer :: Ninstance,NofMyHomog,h
class(tNode), pointer :: num_generic class(tNode), pointer :: &
num_generic, &
material_homogenization, &
homog, &
homogDamage
write(6,'(/,a)') ' <<<+- damage_'//DAMAGE_local_label//' init -+>>>'; flush(6) write(6,'(/,a)') ' <<<+- damage_local init -+>>>'; flush(6)
!---------------------------------------------------------------------------------------------- !----------------------------------------------------------------------------------------------
! read numerics parameter and do sanity check ! read numerics parameter and do sanity check
@ -57,11 +60,18 @@ subroutine damage_local_init
Ninstance = count(damage_type == DAMAGE_local_ID) Ninstance = count(damage_type == DAMAGE_local_ID)
allocate(param(Ninstance)) allocate(param(Ninstance))
do h = 1, size(config_homogenization) material_homogenization => material_root%get('homogenization')
do h = 1, material_homogenization%length
if (damage_type(h) /= DAMAGE_LOCAL_ID) cycle if (damage_type(h) /= DAMAGE_LOCAL_ID) cycle
associate(prm => param(damage_typeInstance(h)),config => config_homogenization(h)) homog => material_homogenization%get(h)
homogDamage => homog%get('damage')
associate(prm => param(damage_typeInstance(h)))
prm%output = config%getStrings('(output)',defaultVal=emptyStringArray) #if defined (__GFORTRAN__)
prm%output = output_asStrings(homogDamage)
#else
prm%output = homogDamage%get_asStrings('output',defaultVal=emptyStringArray)
#endif
NofMyHomog = count(material_homogenizationAt == h) NofMyHomog = count(material_homogenizationAt == h)
damageState(h)%sizeState = 1 damageState(h)%sizeState = 1
@ -152,8 +162,8 @@ subroutine damage_local_results(homog,group)
associate(prm => param(damage_typeInstance(homog))) associate(prm => param(damage_typeInstance(homog)))
outputsLoop: do o = 1,size(prm%output) outputsLoop: do o = 1,size(prm%output)
select case(prm%output(o)) select case(prm%output(o))
case ('damage') case ('phi')
call results_writeDataset(group,damage(homog)%p,'phi',& call results_writeDataset(group,damage(homog)%p,prm%output(o),&
'damage indicator','-') 'damage indicator','-')
end select end select
enddo outputsLoop enddo outputsLoop

View File

@ -18,9 +18,9 @@ subroutine damage_none_init
integer :: h,NofMyHomog integer :: h,NofMyHomog
write(6,'(/,a)') ' <<<+- damage_'//DAMAGE_NONE_LABEL//' init -+>>>'; flush(6) write(6,'(/,a)') ' <<<+- damage_none init -+>>>'; flush(6)
do h = 1, size(config_homogenization) do h = 1, material_Nhomogenization
if (damage_type(h) /= DAMAGE_NONE_ID) cycle if (damage_type(h) /= DAMAGE_NONE_ID) cycle
NofMyHomog = count(material_homogenizationAt == h) NofMyHomog = count(material_homogenizationAt == h)

View File

@ -6,7 +6,6 @@ module damage_nonlocal
use prec use prec
use material use material
use config use config
use numerics
use YAML_types use YAML_types
use crystallite use crystallite
use lattice use lattice
@ -49,9 +48,12 @@ subroutine damage_nonlocal_init
integer :: Ninstance,NofMyHomog,h integer :: Ninstance,NofMyHomog,h
class(tNode), pointer :: & class(tNode), pointer :: &
num_generic num_generic, &
material_homogenization, &
homog, &
homogDamage
write(6,'(/,a)') ' <<<+- damage_'//DAMAGE_nonlocal_label//' init -+>>>'; flush(6) write(6,'(/,a)') ' <<<+- damage_nonlocal init -+>>>'; flush(6)
!------------------------------------------------------------------------------------ !------------------------------------------------------------------------------------
! read numerics parameter ! read numerics parameter
@ -61,11 +63,18 @@ subroutine damage_nonlocal_init
Ninstance = count(damage_type == DAMAGE_nonlocal_ID) Ninstance = count(damage_type == DAMAGE_nonlocal_ID)
allocate(param(Ninstance)) allocate(param(Ninstance))
do h = 1, size(config_homogenization) material_homogenization => material_root%get('homogenization')
do h = 1, material_homogenization%length
if (damage_type(h) /= DAMAGE_NONLOCAL_ID) cycle if (damage_type(h) /= DAMAGE_NONLOCAL_ID) cycle
associate(prm => param(damage_typeInstance(h)),config => config_homogenization(h)) homog => material_homogenization%get(h)
homogDamage => homog%get('damage')
associate(prm => param(damage_typeInstance(h)))
prm%output = config%getStrings('(output)',defaultVal=emptyStringArray) #if defined (__GFORTRAN__)
prm%output = output_asStrings(homogDamage)
#else
prm%output = homogDamage%get_asStrings('output',defaultVal=emptyStringArray)
#endif
NofMyHomog = count(material_homogenizationAt == h) NofMyHomog = count(material_homogenizationAt == h)
damageState(h)%sizeState = 1 damageState(h)%sizeState = 1
@ -191,8 +200,8 @@ subroutine damage_nonlocal_results(homog,group)
associate(prm => param(damage_typeInstance(homog))) associate(prm => param(damage_typeInstance(homog)))
outputsLoop: do o = 1,size(prm%output) outputsLoop: do o = 1,size(prm%output)
select case(prm%output(o)) select case(prm%output(o))
case ('damage') case ('phi')
call results_writeDataset(group,damage(homog)%p,'phi',& call results_writeDataset(group,damage(homog)%p,prm%output(o),&
'damage indicator','-') 'damage indicator','-')
end select end select
enddo outputsLoop enddo outputsLoop

View File

@ -1,50 +0,0 @@
!--------------------------------------------------------------------------------------------------
!> @author Franz Roters, Max-Planck-Institut für Eisenforschung GmbH
!> @author Philip Eisenlohr, Max-Planck-Institut für Eisenforschung GmbH
!> @author Christoph Kords, Max-Planck-Institut für Eisenforschung GmbH
!> @author Martin Diehl, Max-Planck-Institut für Eisenforschung GmbH
!> @brief Reading in and interpretating the debugging settings for the various modules
!--------------------------------------------------------------------------------------------------
module debug
use prec
use IO
use YAML_types
use YAML_parse
implicit none
private
class(tNode), pointer, protected, public :: &
debug_root !< root pointer storing the debug YAML structure
public :: debug_init
contains
!--------------------------------------------------------------------------------------------------
!> @brief reads in parameters from debug.config and allocates arrays
!--------------------------------------------------------------------------------------------------
subroutine debug_init
character(len=:), allocatable :: &
debug_input, &
debug_inFlow
logical :: fexist
write(6,'(/,a)') ' <<<+- debug init -+>>>'
#ifdef DEBUG
write(6,'(a)') achar(27)//'[31m <<<+- DEBUG version -+>>>'//achar(27)//'[0m'
#endif
debug_root => emptyDict
inquire(file='debug.yaml', exist=fexist)
fileExists: if (fexist) then
debug_input = IO_read('debug.yaml')
debug_inFlow = to_flow(debug_input)
debug_root => parse_flow(debug_inFlow)
endif fileExists
end subroutine debug_init
end module debug

View File

@ -13,7 +13,6 @@ program DAMASK_grid
use DAMASK_interface use DAMASK_interface
use IO use IO
use config use config
use debug
use math use math
use CPFEM2 use CPFEM2
use material use material

View File

@ -12,8 +12,7 @@ module discretization_grid
use system_routines use system_routines
use DAMASK_interface use DAMASK_interface
use IO use IO
use debug use config
use numerics
use results use results
use discretization use discretization
use geometry_plastic_nonlocal use geometry_plastic_nonlocal

View File

@ -15,7 +15,7 @@ module grid_damage_spectral
use spectral_utilities use spectral_utilities
use discretization_grid use discretization_grid
use damage_nonlocal use damage_nonlocal
use numerics use config
use YAML_types use YAML_types
implicit none implicit none

View File

@ -16,11 +16,10 @@ module grid_mech_FEM
use math use math
use spectral_utilities use spectral_utilities
use FEsolving use FEsolving
use numerics use config
use homogenization use homogenization
use discretization use discretization
use discretization_grid use discretization_grid
use debug
implicit none implicit none
private private

View File

@ -17,10 +17,8 @@ module grid_mech_spectral_basic
use spectral_utilities use spectral_utilities
use FEsolving use FEsolving
use config use config
use numerics
use homogenization use homogenization
use discretization_grid use discretization_grid
use debug
implicit none implicit none
private private

View File

@ -18,10 +18,8 @@ module grid_mech_spectral_polarisation
use spectral_utilities use spectral_utilities
use FEsolving use FEsolving
use config use config
use numerics
use homogenization use homogenization
use discretization_grid use discretization_grid
use debug
implicit none implicit none
private private

View File

@ -16,7 +16,7 @@ module grid_thermal_spectral
use discretization_grid use discretization_grid
use thermal_conduction use thermal_conduction
use YAML_types use YAML_types
use numerics use config
use material use material
implicit none implicit none

View File

@ -14,8 +14,6 @@ module spectral_utilities
use rotations use rotations
use IO use IO
use discretization_grid use discretization_grid
use numerics
use debug
use config use config
use discretization use discretization
use homogenization use homogenization

View File

@ -8,10 +8,8 @@ module homogenization
use prec use prec
use IO use IO
use config use config
use debug
use math use math
use material use material
use numerics
use constitutive use constitutive
use crystallite use crystallite
use FEsolving use FEsolving
@ -180,7 +178,6 @@ subroutine homogenization_init
if (any(damage_type == DAMAGE_local_ID)) call damage_local_init if (any(damage_type == DAMAGE_local_ID)) call damage_local_init
if (any(damage_type == DAMAGE_nonlocal_ID)) call damage_nonlocal_init if (any(damage_type == DAMAGE_nonlocal_ID)) call damage_nonlocal_init
call config_deallocate('material.config/homogenization')
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! allocate and initialize global variables ! allocate and initialize global variables
@ -607,8 +604,8 @@ subroutine homogenization_results
!real(pReal), dimension(:,:,:), allocatable :: temp !real(pReal), dimension(:,:,:), allocatable :: temp
do p=1,size(config_name_homogenization) do p=1,size(material_name_homogenization)
group_base = 'current/materialpoint/'//trim(config_name_homogenization(p)) group_base = 'current/materialpoint/'//trim(material_name_homogenization(p))
call results_closeGroup(results_addGroup(group_base)) call results_closeGroup(results_addGroup(group_base))
group = trim(group_base)//'/generic' group = trim(group_base)//'/generic'

View File

@ -87,9 +87,12 @@ module subroutine mech_RGC_init(num_homogMech)
sizeState, nIntFaceTot sizeState, nIntFaceTot
class (tNode), pointer :: & class (tNode), pointer :: &
num_RGC ! pointer to RGC numerics data num_RGC, & ! pointer to RGC numerics data
material_homogenization, &
homog, &
homogMech
write(6,'(/,a)') ' <<<+- homogenization_'//HOMOGENIZATION_RGC_label//' init -+>>>' write(6,'(/,a)') ' <<<+- homogenization_mech_rgc init -+>>>'
write(6,'(/,a)') ' Tjahjanto et al., International Journal of Material Forming 2(1):939942, 2009' write(6,'(/,a)') ' Tjahjanto et al., International Journal of Material Forming 2(1):939942, 2009'
write(6,'(a)') ' https://doi.org/10.1007/s12289-009-0619-1' write(6,'(a)') ' https://doi.org/10.1007/s12289-009-0619-1'
@ -135,13 +138,16 @@ module subroutine mech_RGC_init(num_homogMech)
if (num%volDiscrMod < 0.0_pReal) call IO_error(301,ext_msg='volDiscrMod_RGC') if (num%volDiscrMod < 0.0_pReal) call IO_error(301,ext_msg='volDiscrMod_RGC')
if (num%volDiscrPow <= 0.0_pReal) call IO_error(301,ext_msg='volDiscrPw_RGC') if (num%volDiscrPow <= 0.0_pReal) call IO_error(301,ext_msg='volDiscrPw_RGC')
material_homogenization => material_root%get('homogenization')
do h = 1, size(homogenization_type) do h = 1, size(homogenization_type)
if (homogenization_type(h) /= HOMOGENIZATION_RGC_ID) cycle if (homogenization_type(h) /= HOMOGENIZATION_RGC_ID) cycle
homog => material_homogenization%get(h)
homogMech => homog%get('mech')
associate(prm => param(homogenization_typeInstance(h)), & associate(prm => param(homogenization_typeInstance(h)), &
stt => state(homogenization_typeInstance(h)), & stt => state(homogenization_typeInstance(h)), &
st0 => state0(homogenization_typeInstance(h)), & st0 => state0(homogenization_typeInstance(h)), &
dst => dependentState(homogenization_typeInstance(h)), & dst => dependentState(homogenization_typeInstance(h)))
config => config_homogenization(h))
#ifdef DEBUG #ifdef DEBUG
if (h==material_homogenizationAt(debugHomog%element)) then if (h==material_homogenizationAt(debugHomog%element)) then
@ -149,17 +155,21 @@ module subroutine mech_RGC_init(num_homogMech)
endif endif
#endif #endif
prm%output = config%getStrings('(output)',defaultVal=emptyStringArray) #if defined (__GFORTRAN__)
prm%output = output_asStrings(homogMech)
#else
prm%output = homogMech%get_asStrings('output',defaultVal=emptyStringArray)
#endif
prm%Nconstituents = config%getInts('clustersize',requiredSize=3) prm%Nconstituents = homogMech%get_asInts('cluster_size',requiredSize=3)
if (homogenization_Ngrains(h) /= product(prm%Nconstituents)) & if (homogenization_Ngrains(h) /= product(prm%Nconstituents)) &
call IO_error(211,ext_msg='clustersize ('//HOMOGENIZATION_RGC_label//')') call IO_error(211,ext_msg='clustersize (mech_rgc)')
prm%xiAlpha = config%getFloat('scalingparameter') prm%xiAlpha = homogMech%get_asFloat('xi_alpha')
prm%ciAlpha = config%getFloat('overproportionality') prm%ciAlpha = homogMech%get_asFloat('c_alpha')
prm%dAlpha = config%getFloats('grainsize', requiredSize=3) prm%dAlpha = homogMech%get_asFloats('D_alpha', requiredSize=3)
prm%angles = config%getFloats('clusterorientation',requiredSize=3) prm%angles = homogMech%get_asFloats('a_g', requiredSize=3)
NofMyHomog = count(material_homogenizationAt == h) NofMyHomog = count(material_homogenizationAt == h)
nIntFaceTot = 3*( (prm%Nconstituents(1)-1)*prm%Nconstituents(2)*prm%Nconstituents(3) & nIntFaceTot = 3*( (prm%Nconstituents(1)-1)*prm%Nconstituents(2)*prm%Nconstituents(3) &
@ -946,23 +956,23 @@ module subroutine mech_RGC_results(instance,group)
associate(stt => state(instance), dst => dependentState(instance), prm => param(instance)) associate(stt => state(instance), dst => dependentState(instance), prm => param(instance))
outputsLoop: do o = 1,size(prm%output) outputsLoop: do o = 1,size(prm%output)
select case(trim(prm%output(o))) select case(trim(prm%output(o)))
case('constitutivework') case('W')
call results_writeDataset(group,stt%work,'W',& call results_writeDataset(group,stt%work,trim(prm%output(o)), &
'work density','J/m³') 'work density','J/m³')
case('magnitudemismatch') case('M')
call results_writeDataset(group,dst%mismatch,'N',& call results_writeDataset(group,dst%mismatch,trim(prm%output(o)), &
'average mismatch tensor','1') 'average mismatch tensor','1')
case('penaltyenergy') case('R')
call results_writeDataset(group,stt%penaltyEnergy,'R',& call results_writeDataset(group,stt%penaltyEnergy,trim(prm%output(o)), &
'mismatch penalty density','J/m³') 'mismatch penalty density','J/m³')
case('volumediscrepancy') case('Delta_V')
call results_writeDataset(group,dst%volumeDiscrepancy,'Delta_V',& call results_writeDataset(group,dst%volumeDiscrepancy,trim(prm%output(o)), &
'volume discrepancy','m³') 'volume discrepancy','m³')
case('maximumrelaxrate') case('max_a_dot')
call results_writeDataset(group,dst%relaxationrate_max,'max_alpha_dot',& call results_writeDataset(group,dst%relaxationrate_max,trim(prm%output(o)), &
'maximum relaxation rate','m/s') 'maximum relaxation rate','m/s')
case('averagerelaxrate') case('avg_a_dot')
call results_writeDataset(group,dst%relaxationrate_avg,'avg_alpha_dot',& call results_writeDataset(group,dst%relaxationrate_avg,trim(prm%output(o)), &
'average relaxation rate','m/s') 'average relaxation rate','m/s')
end select end select
enddo outputsLoop enddo outputsLoop

View File

@ -32,31 +32,33 @@ module subroutine mech_isostrain_init
Ninstance, & Ninstance, &
h, & h, &
NofMyHomog NofMyHomog
character(len=pStringLen) :: & class(tNode), pointer :: &
tag = '' material_homogenization, &
homog, &
homogMech
write(6,'(/,a)') ' <<<+- homogenization_'//HOMOGENIZATION_ISOSTRAIN_LABEL//' init -+>>>' write(6,'(/,a)') ' <<<+- homogenization_mech_isostrain init -+>>>'
Ninstance = count(homogenization_type == HOMOGENIZATION_ISOSTRAIN_ID) Ninstance = count(homogenization_type == HOMOGENIZATION_ISOSTRAIN_ID)
write(6,'(a16,1x,i5,/)') '# instances:',Ninstance; flush(6) write(6,'(a16,1x,i5,/)') '# instances:',Ninstance; flush(6)
allocate(param(Ninstance)) ! one container of parameters per instance allocate(param(Ninstance)) ! one container of parameters per instance
material_homogenization => material_root%get('homogenization')
do h = 1, size(homogenization_type) do h = 1, size(homogenization_type)
if (homogenization_type(h) /= HOMOGENIZATION_ISOSTRAIN_ID) cycle if (homogenization_type(h) /= HOMOGENIZATION_ISOSTRAIN_ID) cycle
homog => material_homogenization%get(h)
associate(prm => param(homogenization_typeInstance(h)),& homogMech => homog%get('mech')
config => config_homogenization(h)) associate(prm => param(homogenization_typeInstance(h)))
prm%Nconstituents = config_homogenization(h)%getInt('nconstituents') prm%Nconstituents = homogMech%get_asInt('N_constituents')
tag = 'sum' select case(homogMech%get_asString('mapping',defaultVal = 'sum'))
select case(trim(config%getString('mapping',defaultVal = tag)))
case ('sum') case ('sum')
prm%mapping = parallel_ID prm%mapping = parallel_ID
case ('avg') case ('avg')
prm%mapping = average_ID prm%mapping = average_ID
case default case default
call IO_error(211,ext_msg=trim(tag)//' ('//HOMOGENIZATION_ISOSTRAIN_LABEL//')') call IO_error(211,ext_msg='sum'//' (mech_isostrain)')
end select end select
NofMyHomog = count(material_homogenizationAt == h) NofMyHomog = count(material_homogenizationAt == h)

View File

@ -18,7 +18,7 @@ module subroutine mech_none_init
h, & h, &
NofMyHomog NofMyHomog
write(6,'(/,a)') ' <<<+- homogenization_'//HOMOGENIZATION_NONE_label//' init -+>>>' write(6,'(/,a)') ' <<<+- homogenization_mech_none init -+>>>'
Ninstance = count(homogenization_type == HOMOGENIZATION_NONE_ID) Ninstance = count(homogenization_type == HOMOGENIZATION_NONE_ID)
write(6,'(a16,1x,i5,/)') '# instances:',Ninstance; flush(6) write(6,'(a16,1x,i5,/)') '# instances:',Ninstance; flush(6)

View File

@ -10,10 +10,10 @@ submodule(constitutive:constitutive_damage) kinematics_cleavage_opening
type :: tParameters !< container type for internal constitutive parameters type :: tParameters !< container type for internal constitutive parameters
integer :: & integer :: &
sum_N_cl sum_N_cl !< total number of cleavage planes
real(pReal) :: & real(pReal) :: &
sdot0, & sdot0, & !< opening rate of cleavage planes
n n !< damage rate sensitivity
real(pReal), dimension(:), allocatable :: & real(pReal), dimension(:), allocatable :: &
critLoad critLoad
real(pReal), dimension(:,:,:,:), allocatable :: & real(pReal), dimension(:,:,:,:), allocatable :: &
@ -30,54 +30,73 @@ contains
!> @brief module initialization !> @brief module initialization
!> @details reads in material parameters, allocates arrays, and does sanity checks !> @details reads in material parameters, allocates arrays, and does sanity checks
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
module subroutine kinematics_cleavage_opening_init module function kinematics_cleavage_opening_init(kinematics_length) result(myKinematics)
integer, intent(in) :: kinematics_length
logical, dimension(:,:), allocatable :: myKinematics
integer :: Ninstance,p integer :: Ninstance,p,k
integer, dimension(:), allocatable :: N_cl !< active number of cleavage systems per family integer, dimension(:), allocatable :: N_cl !< active number of cleavage systems per family
character(len=pStringLen) :: extmsg = '' character(len=pStringLen) :: extmsg = ''
class(tNode), pointer :: &
phases, &
phase, &
pl, &
kinematics, &
kinematic_type
write(6,'(/,a)') ' <<<+- kinematics_cleavage_opening init -+>>>'
write(6,'(/,a)') ' <<<+- kinematics_'//KINEMATICS_CLEAVAGE_OPENING_LABEL//' init -+>>>' myKinematics = kinematics_active('cleavage_opening',kinematics_length)
Ninstance = count(phase_kinematics == KINEMATICS_CLEAVAGE_OPENING_ID) Ninstance = count(myKinematics)
write(6,'(a16,1x,i5,/)') '# instances:',Ninstance; flush(6) write(6,'(a16,1x,i5,/)') '# instances:',Ninstance; flush(6)
if(Ninstance == 0) return
allocate(kinematics_cleavage_opening_instance(size(config_phase)), source=0) phases => material_root%get('phase')
allocate(param(Ninstance)) allocate(param(Ninstance))
allocate(kinematics_cleavage_opening_instance(phases%length), source=0)
do p = 1, size(config_phase) do p = 1, phases%length
kinematics_cleavage_opening_instance(p) = count(phase_kinematics(:,1:p) == KINEMATICS_CLEAVAGE_OPENING_ID) if(any(myKinematics(:,p))) kinematics_cleavage_opening_instance(p) = count(myKinematics(:,1:p))
if (all(phase_kinematics(:,p) /= KINEMATICS_CLEAVAGE_OPENING_ID)) cycle phase => phases%get(p)
pl => phase%get('plasticity')
if(count(myKinematics(:,p)) == 0) cycle
kinematics => phase%get('kinematics')
do k = 1, kinematics%length
if(myKinematics(k,p)) then
associate(prm => param(kinematics_cleavage_opening_instance(p)))
kinematic_type => kinematics%get(k)
associate(prm => param(kinematics_cleavage_opening_instance(p)), & N_cl = kinematic_type%get_asInts('N_cl')
config => config_phase(p)) prm%sum_N_cl = sum(abs(N_cl))
N_cl = config%getInts('ncleavage') prm%n = kinematic_type%get_asFloat('q')
prm%sum_N_cl = sum(abs(N_cl)) prm%sdot0 = kinematic_type%get_asFloat('dot_o')
prm%n = config%getFloat('anisobrittle_ratesensitivity') prm%critLoad = kinematic_type%get_asFloats('g_crit',requiredSize=size(N_cl))
prm%sdot0 = config%getFloat('anisobrittle_sdot0')
prm%critLoad = config%getFloats('anisobrittle_criticalload',requiredSize=size(N_cl)) prm%cleavage_systems = lattice_SchmidMatrix_cleavage(N_cl,phase%get_asString('lattice'),&
phase%get_asFloat('c/a',defaultVal=0.0_pReal))
prm%cleavage_systems = lattice_SchmidMatrix_cleavage(N_cl,config%getString('lattice_structure'),& ! expand: family => system
config%getFloat('c/a',defaultVal=0.0_pReal)) prm%critLoad = math_expand(prm%critLoad,N_cl)
! expand: family => system ! sanity checks
prm%critLoad = math_expand(prm%critLoad,N_cl) if (prm%n <= 0.0_pReal) extmsg = trim(extmsg)//' q'
if (prm%sdot0 <= 0.0_pReal) extmsg = trim(extmsg)//' dot_o'
! sanity checks if (any(prm%critLoad < 0.0_pReal)) extmsg = trim(extmsg)//' g_crit'
if (prm%n <= 0.0_pReal) extmsg = trim(extmsg)//' anisobrittle_n'
if (prm%sdot0 <= 0.0_pReal) extmsg = trim(extmsg)//' anisobrittle_sdot0'
if (any(prm%critLoad < 0.0_pReal)) extmsg = trim(extmsg)//' anisobrittle_critLoad'
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! exit if any parameter is out of range ! exit if any parameter is out of range
if (extmsg /= '') call IO_error(211,ext_msg=trim(extmsg)//'('//KINEMATICS_CLEAVAGE_OPENING_LABEL//')') if (extmsg /= '') call IO_error(211,ext_msg=trim(extmsg)//'(cleavage_opening)')
end associate
end associate endif
enddo
enddo enddo
end subroutine kinematics_cleavage_opening_init
end function kinematics_cleavage_opening_init
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------

View File

@ -10,10 +10,10 @@ submodule(constitutive:constitutive_damage) kinematics_slipplane_opening
type :: tParameters !< container type for internal constitutive parameters type :: tParameters !< container type for internal constitutive parameters
integer :: & integer :: &
sum_N_sl sum_N_sl !< total number of cleavage planes
real(pReal) :: & real(pReal) :: &
sdot0, & sdot0, & !< opening rate of cleavage planes
n n !< damage rate sensitivity
real(pReal), dimension(:), allocatable :: & real(pReal), dimension(:), allocatable :: &
critLoad critLoad
real(pReal), dimension(:,:,:), allocatable :: & real(pReal), dimension(:,:,:), allocatable :: &
@ -32,64 +32,85 @@ contains
!> @brief module initialization !> @brief module initialization
!> @details reads in material parameters, allocates arrays, and does sanity checks !> @details reads in material parameters, allocates arrays, and does sanity checks
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
module subroutine kinematics_slipplane_opening_init module function kinematics_slipplane_opening_init(kinematics_length) result(myKinematics)
integer :: Ninstance,p,i integer, intent(in) :: kinematics_length
logical, dimension(:,:), allocatable :: myKinematics
integer :: Ninstance,p,i,k
character(len=pStringLen) :: extmsg = '' character(len=pStringLen) :: extmsg = ''
integer, dimension(:), allocatable :: N_sl integer, dimension(:), allocatable :: N_sl
real(pReal), dimension(:,:), allocatable :: d,n,t real(pReal), dimension(:,:), allocatable :: d,n,t
class(tNode), pointer :: &
phases, &
phase, &
pl, &
kinematics, &
kinematic_type
write(6,'(/,a)') ' <<<+- kinematics_slipplane init -+>>>'
write(6,'(/,a)') ' <<<+- kinematics_'//KINEMATICS_SLIPPLANE_OPENING_LABEL//' init -+>>>' myKinematics = kinematics_active('slipplane_opening',kinematics_length)
Ninstance = count(phase_kinematics == KINEMATICS_SLIPPLANE_OPENING_ID) Ninstance = count(myKinematics)
write(6,'(a16,1x,i5,/)') '# instances:',Ninstance; flush(6) write(6,'(a16,1x,i5,/)') '# instances:',Ninstance; flush(6)
if(Ninstance == 0) return
allocate(kinematics_slipplane_opening_instance(size(config_phase)), source=0) phases => material_root%get('phase')
allocate(kinematics_slipplane_opening_instance(phases%length), source=0)
allocate(param(Ninstance)) allocate(param(Ninstance))
do p = 1, size(config_phase) do p = 1, phases%length
kinematics_slipplane_opening_instance(p) = count(phase_kinematics(:,1:p) == KINEMATICS_SLIPPLANE_OPENING_ID) if(any(myKinematics(:,p))) kinematics_slipplane_opening_instance(p) = count(myKinematics(:,1:p))
if (all(phase_kinematics(:,p) /= KINEMATICS_SLIPPLANE_OPENING_ID)) cycle phase => phases%get(p)
associate(prm => param(kinematics_slipplane_opening_instance(p)), & pl => phase%get('plasticity')
config => config_phase(p)) if(count(myKinematics(:,p)) == 0) cycle
kinematics => phase%get('kinematics')
do k = 1, kinematics%length
if(myKinematics(k,p)) then
associate(prm => param(kinematics_slipplane_opening_instance(p)))
kinematic_type => kinematics%get(k)
prm%sdot0 = config%getFloat('anisoductile_sdot0') prm%sdot0 = kinematic_type%get_asFloat('dot_o')
prm%n = config%getFloat('anisoductile_ratesensitivity') prm%n = kinematic_type%get_asFloat('q')
N_sl = config%getInts('nslip') N_sl = pl%get_asInts('N_sl')
prm%sum_N_sl = sum(abs(N_sl)) prm%sum_N_sl = sum(abs(N_sl))
d = lattice_slip_direction (N_sl,config%getString('lattice_structure'),& d = lattice_slip_direction (N_sl,phase%get_asString('lattice'),&
config%getFloat('c/a',defaultVal=0.0_pReal)) phase%get_asFloat('c/a',defaultVal=0.0_pReal))
t = lattice_slip_transverse(N_sl,config%getString('lattice_structure'),& t = lattice_slip_transverse(N_sl,phase%get_asString('lattice'),&
config%getFloat('c/a',defaultVal=0.0_pReal)) phase%get_asFloat('c/a',defaultVal=0.0_pReal))
n = lattice_slip_normal (N_sl,config%getString('lattice_structure'),& n = lattice_slip_normal (N_sl,phase%get_asString('lattice'),&
config%getFloat('c/a',defaultVal=0.0_pReal)) phase%get_asFloat('c/a',defaultVal=0.0_pReal))
allocate(prm%P_d(3,3,size(d,2)),prm%P_t(3,3,size(t,2)),prm%P_n(3,3,size(n,2))) allocate(prm%P_d(3,3,size(d,2)),prm%P_t(3,3,size(t,2)),prm%P_n(3,3,size(n,2)))
do i=1, size(n,2) do i=1, size(n,2)
prm%P_d(1:3,1:3,i) = math_outer(d(1:3,i), n(1:3,i)) prm%P_d(1:3,1:3,i) = math_outer(d(1:3,i), n(1:3,i))
prm%P_t(1:3,1:3,i) = math_outer(t(1:3,i), n(1:3,i)) prm%P_t(1:3,1:3,i) = math_outer(t(1:3,i), n(1:3,i))
prm%P_n(1:3,1:3,i) = math_outer(n(1:3,i), n(1:3,i)) prm%P_n(1:3,1:3,i) = math_outer(n(1:3,i), n(1:3,i))
enddo enddo
prm%critLoad = config%getFloats('anisoductile_criticalload',requiredSize=size(N_sl)) prm%critLoad = kinematic_type%get_asFloats('g_crit',requiredSize=size(N_sl))
! expand: family => system ! expand: family => system
prm%critLoad = math_expand(prm%critLoad,N_sl) prm%critLoad = math_expand(prm%critLoad,N_sl)
! sanity checks ! sanity checks
if (prm%n <= 0.0_pReal) extmsg = trim(extmsg)//' anisoDuctile_n' if (prm%n <= 0.0_pReal) extmsg = trim(extmsg)//' anisoDuctile_n'
if (prm%sdot0 <= 0.0_pReal) extmsg = trim(extmsg)//' anisoDuctile_sdot0' if (prm%sdot0 <= 0.0_pReal) extmsg = trim(extmsg)//' anisoDuctile_sdot0'
if (any(prm%critLoad < 0.0_pReal)) extmsg = trim(extmsg)//' anisoDuctile_critLoad' if (any(prm%critLoad < 0.0_pReal)) extmsg = trim(extmsg)//' anisoDuctile_critLoad'
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! exit if any parameter is out of range ! exit if any parameter is out of range
if (extmsg /= '') call IO_error(211,ext_msg=trim(extmsg)//'('//KINEMATICS_SLIPPLANE_OPENING_LABEL//')') if (extmsg /= '') call IO_error(211,ext_msg=trim(extmsg)//'(slipplane_opening)')
end associate end associate
endif
enddo
enddo enddo
end subroutine kinematics_slipplane_opening_init
end function kinematics_slipplane_opening_init
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------

View File

@ -24,43 +24,64 @@ contains
!> @brief module initialization !> @brief module initialization
!> @details reads in material parameters, allocates arrays, and does sanity checks !> @details reads in material parameters, allocates arrays, and does sanity checks
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
module subroutine kinematics_thermal_expansion_init module function kinematics_thermal_expansion_init(kinematics_length) result(myKinematics)
integer :: Ninstance,p,i integer, intent(in) :: kinematics_length
logical, dimension(:,:), allocatable :: myKinematics
integer :: Ninstance,p,i,k
real(pReal), dimension(:), allocatable :: temp real(pReal), dimension(:), allocatable :: temp
class(tNode), pointer :: &
phases, &
phase, &
pl, &
kinematics, &
kinematic_type
write(6,'(/,a)') ' <<<+- kinematics_thermal_expansion init -+>>>'
write(6,'(/,a)') ' <<<+- kinematics_'//KINEMATICS_thermal_expansion_LABEL//' init -+>>>' myKinematics = kinematics_active('thermal_expansion',kinematics_length)
Ninstance = count(phase_kinematics == KINEMATICS_thermal_expansion_ID) Ninstance = count(myKinematics)
write(6,'(a16,1x,i5,/)') '# instances:',Ninstance; flush(6) write(6,'(a16,1x,i5,/)') '# instances:',Ninstance; flush(6)
if(Ninstance == 0) return
allocate(kinematics_thermal_expansion_instance(size(config_phase)), source=0) phases => material_root%get('phase')
allocate(param(Ninstance)) allocate(param(Ninstance))
allocate(kinematics_thermal_expansion_instance(phases%length), source=0)
do p = 1, size(config_phase) do p = 1, phases%length
kinematics_thermal_expansion_instance(p) = count(phase_kinematics(:,1:p) == KINEMATICS_thermal_expansion_ID) if(any(myKinematics(:,p))) kinematics_thermal_expansion_instance(p) = count(myKinematics(:,1:p))
if (all(phase_kinematics(:,p) /= KINEMATICS_thermal_expansion_ID)) cycle phase => phases%get(p)
pl => phase%get('plasticity')
if(count(myKinematics(:,p)) == 0) cycle
kinematics => phase%get('kinematics')
do k = 1, kinematics%length
if(myKinematics(k,p)) then
associate(prm => param(kinematics_thermal_expansion_instance(p)))
kinematic_type => kinematics%get(k)
associate(prm => param(kinematics_thermal_expansion_instance(p)), & prm%T_ref = kinematic_type%get_asFloat('T_ref', defaultVal=0.0_pReal)
config => config_phase(p))
prm%T_ref = config%getFloat('reference_temperature', defaultVal=0.0_pReal) ! read up to three parameters (constant, linear, quadratic with T)
temp = kinematic_type%get_asFloats('A_11')
prm%expansion(1,1,1:size(temp)) = temp
temp = kinematic_type%get_asFloats('A_22',defaultVal=[(0.0_pReal, i=1,size(temp))],requiredSize=size(temp))
prm%expansion(2,2,1:size(temp)) = temp
temp = kinematic_type%get_asFloats('A_33',defaultVal=[(0.0_pReal, i=1,size(temp))],requiredSize=size(temp))
prm%expansion(3,3,1:size(temp)) = temp
do i=1, size(prm%expansion,3)
prm%expansion(1:3,1:3,i) = lattice_applyLatticeSymmetry33(prm%expansion(1:3,1:3,i),&
phase%get_asString('lattice'))
enddo
! read up to three parameters (constant, linear, quadratic with T) end associate
temp = config%getFloats('thermal_expansion11') endif
prm%expansion(1,1,1:size(temp)) = temp
temp = config%getFloats('thermal_expansion22',defaultVal=[(0.0_pReal, i=1,size(temp))],requiredSize=size(temp))
prm%expansion(2,2,1:size(temp)) = temp
temp = config%getFloats('thermal_expansion33',defaultVal=[(0.0_pReal, i=1,size(temp))],requiredSize=size(temp))
prm%expansion(3,3,1:size(temp)) = temp
do i=1, size(prm%expansion,3)
prm%expansion(1:3,1:3,i) = lattice_applyLatticeSymmetry33(prm%expansion(1:3,1:3,i),config%getString('lattice_structure'))
enddo enddo
end associate
enddo enddo
end subroutine kinematics_thermal_expansion_init
end function kinematics_thermal_expansion_init
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------

View File

@ -452,11 +452,15 @@ contains
subroutine lattice_init subroutine lattice_init
integer :: Nphases, p,i integer :: Nphases, p,i
character(len=pStringLen) :: structure = '' class(tNode), pointer :: &
phases, &
phase, &
elasticity
write(6,'(/,a)') ' <<<+- lattice init -+>>>'; flush(6) write(6,'(/,a)') ' <<<+- lattice init -+>>>'; flush(6)
Nphases = size(config_phase) phases => material_root%get('phase')
Nphases = phases%length
allocate(lattice_structure(Nphases),source = lattice_UNDEFINED_ID) allocate(lattice_structure(Nphases),source = lattice_UNDEFINED_ID)
allocate(lattice_C66(6,6,Nphases), source=0.0_pReal) allocate(lattice_C66(6,6,Nphases), source=0.0_pReal)
@ -469,21 +473,21 @@ subroutine lattice_init
lattice_mu, lattice_nu,& lattice_mu, lattice_nu,&
source=[(0.0_pReal,i=1,Nphases)]) source=[(0.0_pReal,i=1,Nphases)])
do p = 1, size(config_phase) do p = 1, phases%length
phase => phases%get(p)
elasticity => phase%get('elasticity')
lattice_C66(1,1,p) = elasticity%get_asFloat('C_11')
lattice_C66(1,2,p) = elasticity%get_asFloat('C_12')
lattice_C66(1,1,p) = config_phase(p)%getFloat('c11') lattice_C66(1,3,p) = elasticity%get_asFloat('C_13',defaultVal=0.0_pReal)
lattice_C66(1,2,p) = config_phase(p)%getFloat('c12') lattice_C66(2,2,p) = elasticity%get_asFloat('C_22',defaultVal=0.0_pReal)
lattice_C66(2,3,p) = elasticity%get_asFloat('C_23',defaultVal=0.0_pReal)
lattice_C66(3,3,p) = elasticity%get_asFloat('C_33',defaultVal=0.0_pReal)
lattice_C66(4,4,p) = elasticity%get_asFloat('C_44',defaultVal=0.0_pReal)
lattice_C66(5,5,p) = elasticity%get_asFloat('C_55',defaultVal=0.0_pReal)
lattice_C66(6,6,p) = elasticity%get_asFloat('C_66',defaultVal=0.0_pReal)
lattice_C66(1,3,p) = config_phase(p)%getFloat('c13',defaultVal=0.0_pReal) select case(phase%get_asString('lattice'))
lattice_C66(2,2,p) = config_phase(p)%getFloat('c22',defaultVal=0.0_pReal)
lattice_C66(2,3,p) = config_phase(p)%getFloat('c23',defaultVal=0.0_pReal)
lattice_C66(3,3,p) = config_phase(p)%getFloat('c33',defaultVal=0.0_pReal)
lattice_C66(4,4,p) = config_phase(p)%getFloat('c44',defaultVal=0.0_pReal)
lattice_C66(5,5,p) = config_phase(p)%getFloat('c55',defaultVal=0.0_pReal)
lattice_C66(6,6,p) = config_phase(p)%getFloat('c66',defaultVal=0.0_pReal)
structure = config_phase(p)%getString('lattice_structure')
select case(trim(structure))
case('iso') case('iso')
lattice_structure(p) = lattice_ISO_ID lattice_structure(p) = lattice_ISO_ID
case('fcc') case('fcc')
@ -497,10 +501,10 @@ subroutine lattice_init
case('ort') case('ort')
lattice_structure(p) = lattice_ORT_ID lattice_structure(p) = lattice_ORT_ID
case default case default
call IO_error(130,ext_msg='lattice_init: '//trim(structure)) call IO_error(130,ext_msg='lattice_init: '//phase%get_asString('lattice'))
end select end select
lattice_C66(1:6,1:6,p) = applyLatticeSymmetryC66(lattice_C66(1:6,1:6,p),structure) lattice_C66(1:6,1:6,p) = applyLatticeSymmetryC66(lattice_C66(1:6,1:6,p),phase%get_asString('lattice'))
lattice_mu(p) = equivalent_mu(lattice_C66(1:6,1:6,p),'voigt') lattice_mu(p) = equivalent_mu(lattice_C66(1:6,1:6,p),'voigt')
lattice_nu(p) = equivalent_nu(lattice_C66(1:6,1:6,p),'voigt') lattice_nu(p) = equivalent_nu(lattice_C66(1:6,1:6,p),'voigt')
@ -513,20 +517,22 @@ subroutine lattice_init
! SHOULD NOT BE PART OF LATTICE BEGIN ! SHOULD NOT BE PART OF LATTICE BEGIN
lattice_thermalConductivity(1,1,p) = config_phase(p)%getFloat('thermal_conductivity11',defaultVal=0.0_pReal) lattice_thermalConductivity(1,1,p) = phase%get_asFloat('K_11',defaultVal=0.0_pReal)
lattice_thermalConductivity(2,2,p) = config_phase(p)%getFloat('thermal_conductivity22',defaultVal=0.0_pReal) lattice_thermalConductivity(2,2,p) = phase%get_asFloat('K_22',defaultVal=0.0_pReal)
lattice_thermalConductivity(3,3,p) = config_phase(p)%getFloat('thermal_conductivity33',defaultVal=0.0_pReal) lattice_thermalConductivity(3,3,p) = phase%get_asFloat('K_33',defaultVal=0.0_pReal)
lattice_thermalConductivity(1:3,1:3,p) = lattice_applyLatticeSymmetry33(lattice_thermalConductivity(1:3,1:3,p),structure) lattice_thermalConductivity(1:3,1:3,p) = lattice_applyLatticeSymmetry33(lattice_thermalConductivity(1:3,1:3,p), &
phase%get_asString('lattice'))
lattice_specificHeat(p) = config_phase(p)%getFloat('specific_heat',defaultVal=0.0_pReal) lattice_specificHeat(p) = phase%get_asFloat('c_p',defaultVal=0.0_pReal)
lattice_massDensity(p) = config_phase(p)%getFloat('mass_density', defaultVal=0.0_pReal) lattice_massDensity(p) = phase%get_asFloat('rho', defaultVal=0.0_pReal)
lattice_DamageDiffusion(1,1,p) = config_phase(p)%getFloat('damage_diffusion11',defaultVal=0.0_pReal) lattice_DamageDiffusion(1,1,p) = phase%get_asFloat('D_11',defaultVal=0.0_pReal)
lattice_DamageDiffusion(2,2,p) = config_phase(p)%getFloat('damage_diffusion22',defaultVal=0.0_pReal) lattice_DamageDiffusion(2,2,p) = phase%get_asFloat('D_22',defaultVal=0.0_pReal)
lattice_DamageDiffusion(3,3,p) = config_phase(p)%getFloat('damage_diffusion33',defaultVal=0.0_pReal) lattice_DamageDiffusion(3,3,p) = phase%get_asFloat('D_33',defaultVal=0.0_pReal)
lattice_DamageDiffusion(1:3,1:3,p) = lattice_applyLatticeSymmetry33(lattice_DamageDiffusion(1:3,1:3,p),structure) lattice_DamageDiffusion(1:3,1:3,p) = lattice_applyLatticeSymmetry33(lattice_DamageDiffusion(1:3,1:3,p), &
phase%get_asString('lattice'))
lattice_DamageMobility(p) = config_phase(p)%getFloat('damage_mobility',defaultVal=0.0_pReal) lattice_DamageMobility(p) = phase%get_asFloat('M',defaultVal=0.0_pReal)
! SHOULD NOT BE PART OF LATTICE END ! SHOULD NOT BE PART OF LATTICE END
call selfTest call selfTest

View File

@ -11,8 +11,7 @@ module discretization_marc
use math use math
use DAMASK_interface use DAMASK_interface
use IO use IO
use debug use config
use numerics
use FEsolving use FEsolving
use element use element
use discretization use discretization

View File

@ -10,52 +10,22 @@ module material
use config use config
use results use results
use IO use IO
use debug
use rotations use rotations
use discretization use discretization
implicit none implicit none
private private
character(len=*), parameter, public :: &
ELASTICITY_hooke_label = 'hooke', &
PLASTICITY_none_label = 'none', &
PLASTICITY_isotropic_label = 'isotropic', &
PLASTICITY_phenopowerlaw_label = 'phenopowerlaw', &
PLASTICITY_kinehardening_label = 'kinehardening', &
PLASTICITY_dislotwin_label = 'dislotwin', &
PLASTICITY_disloucla_label = 'disloucla', &
PLASTICITY_nonlocal_label = 'nonlocal', &
SOURCE_thermal_dissipation_label = 'thermal_dissipation', &
SOURCE_thermal_externalheat_label = 'thermal_externalheat', &
SOURCE_damage_isoBrittle_label = 'damage_isobrittle', &
SOURCE_damage_isoDuctile_label = 'damage_isoductile', &
SOURCE_damage_anisoBrittle_label = 'damage_anisobrittle', &
SOURCE_damage_anisoDuctile_label = 'damage_anisoductile', &
KINEMATICS_thermal_expansion_label = 'thermal_expansion', &
KINEMATICS_cleavage_opening_label = 'cleavage_opening', &
KINEMATICS_slipplane_opening_label = 'slipplane_opening', &
STIFFNESS_DEGRADATION_damage_label = 'damage', &
THERMAL_isothermal_label = 'isothermal', &
THERMAL_adiabatic_label = 'adiabatic', &
THERMAL_conduction_label = 'conduction', &
DAMAGE_none_label = 'none', &
DAMAGE_local_label = 'local', &
DAMAGE_nonlocal_label = 'nonlocal', &
HOMOGENIZATION_none_label = 'none', &
HOMOGENIZATION_isostrain_label = 'isostrain', &
HOMOGENIZATION_rgc_label = 'rgc'
enum, bind(c); enumerator :: & enum, bind(c); enumerator :: &
ELASTICITY_UNDEFINED_ID ,& ELASTICITY_UNDEFINED_ID, &
ELASTICITY_HOOKE_ID ,& ELASTICITY_HOOKE_ID, &
PLASTICITY_UNDEFINED_ID ,& PLASTICITY_UNDEFINED_ID, &
PLASTICITY_NONE_ID, & PLASTICITY_NONE_ID, &
PLASTICITY_ISOTROPIC_ID, & PLASTICITY_ISOTROPIC_ID, &
PLASTICITY_PHENOPOWERLAW_ID, & PLASTICITY_PHENOPOWERLAW_ID, &
PLASTICITY_KINEHARDENING_ID, & PLASTICITY_KINEHARDENING_ID, &
PLASTICITY_DISLOTWIN_ID, & PLASTICITY_DISLOTWIN_ID, &
PLASTICITY_DISLOUCLA_ID, & PLASTICITY_DISLOTUNGSTEN_ID, &
PLASTICITY_NONLOCAL_ID, & PLASTICITY_NONLOCAL_ID, &
SOURCE_UNDEFINED_ID ,& SOURCE_UNDEFINED_ID ,&
SOURCE_THERMAL_DISSIPATION_ID, & SOURCE_THERMAL_DISSIPATION_ID, &
@ -82,10 +52,10 @@ module material
HOMOGENIZATION_RGC_ID HOMOGENIZATION_RGC_ID
end enum end enum
integer(kind(ELASTICITY_undefined_ID)), dimension(:), allocatable, public, protected :: & character(len=pStringLen), public, protected, allocatable, dimension(:) :: &
phase_elasticity !< elasticity of each phase material_name_phase, & !< name of each phase
integer(kind(PLASTICITY_undefined_ID)), dimension(:), allocatable, public, protected :: & material_name_homogenization !< name of each homogenization
phase_plasticity !< plasticity of each phase
integer(kind(THERMAL_isothermal_ID)), dimension(:), allocatable, public, protected :: & integer(kind(THERMAL_isothermal_ID)), dimension(:), allocatable, public, protected :: &
thermal_type !< thermal transport model thermal_type !< thermal transport model
integer(kind(DAMAGE_none_ID)), dimension(:), allocatable, public, protected :: & integer(kind(DAMAGE_none_ID)), dimension(:), allocatable, public, protected :: &
@ -94,23 +64,12 @@ module material
homogenization_type !< type of each homogenization homogenization_type !< type of each homogenization
integer, public, protected :: & integer, public, protected :: &
material_Nphase, & !< number of phases
material_Nhomogenization !< number of homogenizations material_Nhomogenization !< number of homogenizations
integer(kind(SOURCE_undefined_ID)), dimension(:,:), allocatable, public, protected :: &
phase_source, & !< active sources mechanisms of each phase
phase_kinematics, & !< active kinematic mechanisms of each phase
phase_stiffnessDegradation !< active stiffness degradation mechanisms of each phase
integer, public, protected :: & integer, public, protected :: &
homogenization_maxNgrains !< max number of grains in any USED homogenization homogenization_maxNgrains !< max number of grains in any USED homogenization
integer, dimension(:), allocatable, public, protected :: & integer, dimension(:), allocatable, public, protected :: &
phase_Nsources, & !< number of source mechanisms active in each phase
phase_Nkinematics, & !< number of kinematic mechanisms active in each phase
phase_NstiffnessDegradations, & !< number of stiffness degradation mechanisms active in each phase
phase_elasticityInstance, & !< instance of particular elasticity of each phase
phase_plasticityInstance, & !< instance of particular plasticity of each phase
homogenization_Ngrains, & !< number of grains in each homogenization homogenization_Ngrains, & !< number of grains in each homogenization
homogenization_typeInstance, & !< instance of particular type of each homogenization homogenization_typeInstance, & !< instance of particular type of each homogenization
thermal_typeInstance, & !< instance of particular type of each thermal transport thermal_typeInstance, & !< instance of particular type of each thermal transport
@ -129,33 +88,17 @@ module material
integer, dimension(:,:,:), allocatable, public, protected :: & ! (constituent,elem) integer, dimension(:,:,:), allocatable, public, protected :: & ! (constituent,elem)
material_phaseMemberAt !< position of the element within its phase instance material_phaseMemberAt !< position of the element within its phase instance
type(tPlasticState), allocatable, dimension(:), public :: &
plasticState
type(tSourceState), allocatable, dimension(:), public :: &
sourceState
type(tState), allocatable, dimension(:), public :: & type(tState), allocatable, dimension(:), public :: &
homogState, & homogState, &
thermalState, & thermalState, &
damageState damageState
integer, dimension(:,:,:), allocatable, public, protected :: &
material_texture !< texture (index) of each grain,IP,element. Only used by plastic_nonlocal
type(Rotation), dimension(:,:,:), allocatable, public, protected :: & type(Rotation), dimension(:,:,:), allocatable, public, protected :: &
material_orientation0 !< initial orientation of each grain,IP,element material_orientation0 !< initial orientation of each grain,IP,element
logical, dimension(:), allocatable, public, protected :: &
phase_localPlasticity !< flags phases with local constitutive law
integer, dimension(:), allocatable, private :: & integer, dimension(:), allocatable, private :: &
microstructure_Nconstituents !< number of constituents in each microstructure microstructure_Nconstituents !< number of constituents in each microstructure
integer, dimension(:,:), allocatable, private :: &
microstructure_phase, & !< phase IDs of each microstructure
microstructure_texture !< texture IDs of each microstructure
type(Rotation), dimension(:), allocatable, private :: &
texture_orientation !< Euler angles in material.config (possibly rotated for alignment)
! BEGIN DEPRECATED ! BEGIN DEPRECATED
@ -173,24 +116,28 @@ module material
public :: & public :: &
material_init, & material_init, &
material_allocateState, & ELASTICITY_UNDEFINED_ID, &
ELASTICITY_HOOKE_ID ,& ELASTICITY_HOOKE_ID, &
PLASTICITY_UNDEFINED_ID, &
PLASTICITY_NONE_ID, & PLASTICITY_NONE_ID, &
PLASTICITY_ISOTROPIC_ID, & PLASTICITY_ISOTROPIC_ID, &
PLASTICITY_PHENOPOWERLAW_ID, & PLASTICITY_PHENOPOWERLAW_ID, &
PLASTICITY_KINEHARDENING_ID, & PLASTICITY_KINEHARDENING_ID, &
PLASTICITY_DISLOTWIN_ID, & PLASTICITY_DISLOTWIN_ID, &
PLASTICITY_DISLOUCLA_ID, & PLASTICITY_DISLOTUNGSTEN_ID, &
PLASTICITY_NONLOCAL_ID, & PLASTICITY_NONLOCAL_ID, &
SOURCE_UNDEFINED_ID ,&
SOURCE_THERMAL_DISSIPATION_ID, & SOURCE_THERMAL_DISSIPATION_ID, &
SOURCE_THERMAL_EXTERNALHEAT_ID, & SOURCE_THERMAL_EXTERNALHEAT_ID, &
SOURCE_DAMAGE_ISOBRITTLE_ID, & SOURCE_DAMAGE_ISOBRITTLE_ID, &
SOURCE_DAMAGE_ISODUCTILE_ID, & SOURCE_DAMAGE_ISODUCTILE_ID, &
SOURCE_DAMAGE_ANISOBRITTLE_ID, & SOURCE_DAMAGE_ANISOBRITTLE_ID, &
SOURCE_DAMAGE_ANISODUCTILE_ID, & SOURCE_DAMAGE_ANISODUCTILE_ID, &
KINEMATICS_UNDEFINED_ID ,&
KINEMATICS_CLEAVAGE_OPENING_ID, & KINEMATICS_CLEAVAGE_OPENING_ID, &
KINEMATICS_SLIPPLANE_OPENING_ID, & KINEMATICS_SLIPPLANE_OPENING_ID, &
KINEMATICS_THERMAL_EXPANSION_ID, & KINEMATICS_THERMAL_EXPANSION_ID, &
STIFFNESS_DEGRADATION_UNDEFINED_ID, &
STIFFNESS_DEGRADATION_DAMAGE_ID, & STIFFNESS_DEGRADATION_DAMAGE_ID, &
THERMAL_ISOTHERMAL_ID, & THERMAL_ISOTHERMAL_ID, &
THERMAL_ADIABATIC_ID, & THERMAL_ADIABATIC_ID, &
@ -211,18 +158,30 @@ subroutine material_init(restart)
logical, intent(in) :: restart logical, intent(in) :: restart
integer :: i,e,m,c,h, myDebug, myPhase, myHomog, myMicro integer :: ph, myHomog
integer, dimension(:), allocatable :: &
CounterPhase, &
CounterHomogenization
class(tNode), pointer :: & class(tNode), pointer :: &
debug_material ! pointer to material debug options debug_material, & ! pointer to material debug options
phases, &
material_homogenization
character(len=pStringLen) :: sectionName
write(6,'(/,a)') ' <<<+- material init -+>>>'; flush(6) write(6,'(/,a)') ' <<<+- material init -+>>>'; flush(6)
phases => material_root%get('phase')
allocate(material_name_phase(phases%length))
do ph = 1, phases%length
write(sectionName,'(i0,a)') ph,'_'
material_name_phase(ph) = trim(adjustl(sectionName))//phases%getKey(ph) !ToDO: No reason to do. Update damage tests
enddo
material_homogenization => material_root%get('homogenization')
allocate(material_name_homogenization(material_homogenization%length))
do myHomog = 1, material_homogenization%length
write(sectionName,'(i0,a)') myHomog,'_'
material_name_homogenization(myHomog) = trim(adjustl(sectionName))//material_homogenization%getKey(myHomog)
enddo
debug_material => debug_root%get('material',defaultVal=emptyList) debug_material => debug_root%get('material',defaultVal=emptyList)
call material_parsePhase()
if (debug_material%contains('basic')) write(6,'(a)') ' Phase parsed'; flush(6)
call material_parseMicrostructure() call material_parseMicrostructure()
if (debug_material%contains('basic')) write(6,'(a)') ' Microstructure parsed'; flush(6) if (debug_material%contains('basic')) write(6,'(a)') ' Microstructure parsed'; flush(6)
@ -230,18 +189,8 @@ subroutine material_init(restart)
call material_parseHomogenization() call material_parseHomogenization()
if (debug_material%contains('basic')) write(6,'(a)') ' Homogenization parsed'; flush(6) if (debug_material%contains('basic')) write(6,'(a)') ' Homogenization parsed'; flush(6)
call material_parseTexture()
if (debug_material%contains('basic')) write(6,'(a)') ' Texture parsed'; flush(6)
material_Nphase = size(config_phase) if(homogenization_maxNgrains > size(material_phaseAt,1)) call IO_error(148)
material_Nhomogenization = size(config_homogenization)
allocate(plasticState(material_Nphase))
allocate(sourceState (material_Nphase))
do myPhase = 1,material_Nphase
allocate(sourceState(myPhase)%p(phase_Nsources(myPhase)))
enddo
allocate(homogState (material_Nhomogenization)) allocate(homogState (material_Nhomogenization))
allocate(thermalState (material_Nhomogenization)) allocate(thermalState (material_Nhomogenization))
@ -255,97 +204,11 @@ subroutine material_init(restart)
allocate(temperatureRate (material_Nhomogenization)) allocate(temperatureRate (material_Nhomogenization))
do m = 1,size(config_microstructure)
if(minval(microstructure_phase(1:microstructure_Nconstituents(m),m)) < 1 .or. &
maxval(microstructure_phase(1:microstructure_Nconstituents(m),m)) > size(config_phase)) &
call IO_error(150,m,ext_msg='phase')
if(minval(microstructure_texture(1:microstructure_Nconstituents(m),m)) < 1 .or. &
maxval(microstructure_texture(1:microstructure_Nconstituents(m),m)) > size(config_texture)) &
call IO_error(150,m,ext_msg='texture')
if(microstructure_Nconstituents(m) < 1) &
call IO_error(151,m)
enddo
if(homogenization_maxNgrains > size(microstructure_phase,1)) call IO_error(148)
debugOut: if (debug_material%contains('extensive')) then
write(6,'(/,a,/)') ' MATERIAL configuration'
write(6,'(a32,1x,a16,1x,a6)') 'homogenization ','type ','grains'
do h = 1,size(config_homogenization)
write(6,'(1x,a32,1x,a16,1x,i6)') config_name_homogenization(h),homogenization_type(h),homogenization_Ngrains(h)
enddo
write(6,'(/,a14,18x,1x,a11,1x,a12,1x,a13)') 'microstructure','constituents'
do m = 1,size(config_microstructure)
write(6,'(1x,a32,1x,i12)') config_name_microstructure(m), microstructure_Nconstituents(m)
if (microstructure_Nconstituents(m) > 0) then
do c = 1,microstructure_Nconstituents(m)
write(6,'(a1,1x,a32,1x,a32)') '>',config_name_phase(microstructure_phase(c,m)),&
config_name_texture(microstructure_texture(c,m))
enddo
write(6,*)
endif
enddo
endif debugOut
allocate(material_phaseAt(homogenization_maxNgrains,discretization_nElem), source=0)
allocate(material_texture(homogenization_maxNgrains,discretization_nIP,discretization_nElem),source=0) !this is only needed by plasticity nonlocal
allocate(material_orientation0(homogenization_maxNgrains,discretization_nIP,discretization_nElem))
do e = 1, discretization_nElem
do i = 1, discretization_nIP
myMicro = discretization_microstructureAt(e)
do c = 1, homogenization_Ngrains(discretization_homogenizationAt(e))
if(microstructure_phase(c,myMicro) > 0) then
material_phaseAt(c,e) = microstructure_phase(c,myMicro)
else
call IO_error(150,ext_msg='phase')
endif
if(microstructure_texture(c,myMicro) > 0) then
material_texture(c,i,e) = microstructure_texture(c,myMicro)
material_orientation0(c,i,e) = texture_orientation(material_texture(c,i,e))
else
call IO_error(150,ext_msg='texture')
endif
enddo
enddo
enddo
deallocate(microstructure_phase)
deallocate(microstructure_texture)
deallocate(texture_orientation)
allocate(material_homogenizationAt,source=discretization_homogenizationAt)
allocate(material_homogenizationMemberAt(discretization_nIP,discretization_nElem),source=0)
allocate(CounterHomogenization(size(config_homogenization)),source=0)
do e = 1, discretization_nElem
do i = 1, discretization_nIP
CounterHomogenization(material_homogenizationAt(e)) = &
CounterHomogenization(material_homogenizationAt(e)) + 1
material_homogenizationMemberAt(i,e) = CounterHomogenization(material_homogenizationAt(e))
enddo
enddo
allocate(material_phaseMemberAt(homogenization_maxNgrains,discretization_nIP,discretization_nElem),source=0)
allocate(CounterPhase(size(config_phase)),source=0)
do e = 1, discretization_nElem
do i = 1, discretization_nIP
do c = 1, homogenization_maxNgrains
CounterPhase(material_phaseAt(c,e)) = &
CounterPhase(material_phaseAt(c,e)) + 1
material_phaseMemberAt(c,i,e) = CounterPhase(material_phaseAt(c,e))
enddo
enddo
enddo
call config_deallocate('material.config/microstructure')
call config_deallocate('material.config/texture')
if (.not. restart) then if (.not. restart) then
call results_openJobFile call results_openJobFile
call results_mapping_constituent(material_phaseAt,material_phaseMemberAt,config_name_phase) call results_mapping_constituent(material_phaseAt,material_phaseMemberAt,material_name_phase)
call results_mapping_materialpoint(material_homogenizationAt,material_homogenizationMemberAt,config_name_homogenization) call results_mapping_materialpoint(material_homogenizationAt,material_homogenizationMemberAt,material_name_homogenization)
call results_closeJobFile call results_closeJobFile
endif endif
@ -354,7 +217,7 @@ subroutine material_init(restart)
allocate(mappingHomogenizationConst( discretization_nIP,discretization_nElem),source=1) allocate(mappingHomogenizationConst( discretization_nIP,discretization_nElem),source=1)
! hack needed to initialize field values used during constitutive initialization ! hack needed to initialize field values used during constitutive initialization
do myHomog = 1,size(config_homogenization) do myHomog = 1,material_Nhomogenization
thermalMapping (myHomog)%p => mappingHomogenizationConst thermalMapping (myHomog)%p => mappingHomogenizationConst
damageMapping (myHomog)%p => mappingHomogenizationConst damageMapping (myHomog)%p => mappingHomogenizationConst
allocate(temperature (myHomog)%p(1), source=thermal_initialT(myHomog)) allocate(temperature (myHomog)%p(1), source=thermal_initialT(myHomog))
@ -370,82 +233,85 @@ end subroutine material_init
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
subroutine material_parseHomogenization subroutine material_parseHomogenization
integer :: h class(tNode), pointer :: &
character(len=pStringLen) :: tag material_homogenization, &
homog, &
homogMech, &
homogThermal, &
homogDamage
integer :: h
logical, dimension(:), allocatable :: homogenization_active logical, dimension(:), allocatable :: homogenization_active
allocate(homogenization_type(size(config_homogenization)), source=HOMOGENIZATION_undefined_ID) material_homogenization => material_root%get('homogenization')
allocate(thermal_type(size(config_homogenization)), source=THERMAL_isothermal_ID) material_Nhomogenization = material_homogenization%length
allocate(damage_type (size(config_homogenization)), source=DAMAGE_none_ID)
allocate(homogenization_typeInstance(size(config_homogenization)), source=0)
allocate(thermal_typeInstance(size(config_homogenization)), source=0)
allocate(damage_typeInstance(size(config_homogenization)), source=0)
allocate(homogenization_Ngrains(size(config_homogenization)), source=0)
allocate(homogenization_active(size(config_homogenization)), source=.false.) !!!!!!!!!!!!!!!
allocate(thermal_initialT(size(config_homogenization)), source=300.0_pReal)
allocate(damage_initialPhi(size(config_homogenization)), source=1.0_pReal)
forall (h = 1:size(config_homogenization)) & allocate(homogenization_type(material_Nhomogenization), source=HOMOGENIZATION_undefined_ID)
homogenization_active(h) = any(discretization_homogenizationAt == h) allocate(thermal_type(material_Nhomogenization), source=THERMAL_isothermal_ID)
allocate(damage_type (material_Nhomogenization), source=DAMAGE_none_ID)
allocate(homogenization_typeInstance(material_Nhomogenization), source=0)
allocate(thermal_typeInstance(material_Nhomogenization), source=0)
allocate(damage_typeInstance(material_Nhomogenization), source=0)
allocate(homogenization_Ngrains(material_Nhomogenization), source=0)
allocate(homogenization_active(material_Nhomogenization), source=.false.) !!!!!!!!!!!!!!!
allocate(thermal_initialT(material_Nhomogenization), source=300.0_pReal)
allocate(damage_initialPhi(material_Nhomogenization), source=1.0_pReal)
forall (h = 1:material_Nhomogenization) &
homogenization_active(h) = any(discretization_homogenizationAt == h) !ToDo: SR: needed??
do h=1, size(config_homogenization) do h=1, material_Nhomogenization
homog => material_homogenization%get(h)
tag = config_homogenization(h)%getString('mech') homogMech => homog%get('mech')
select case (trim(tag)) select case (homogMech%get_asString('type'))
case(HOMOGENIZATION_NONE_label) case('none')
homogenization_type(h) = HOMOGENIZATION_NONE_ID homogenization_type(h) = HOMOGENIZATION_NONE_ID
homogenization_Ngrains(h) = 1 homogenization_Ngrains(h) = 1
case(HOMOGENIZATION_ISOSTRAIN_label) case('isostrain')
homogenization_type(h) = HOMOGENIZATION_ISOSTRAIN_ID homogenization_type(h) = HOMOGENIZATION_ISOSTRAIN_ID
homogenization_Ngrains(h) = config_homogenization(h)%getInt('nconstituents') homogenization_Ngrains(h) = homogMech%get_asInt('N_constituents')
case(HOMOGENIZATION_RGC_label) case('RGC')
homogenization_type(h) = HOMOGENIZATION_RGC_ID homogenization_type(h) = HOMOGENIZATION_RGC_ID
homogenization_Ngrains(h) = config_homogenization(h)%getInt('nconstituents') homogenization_Ngrains(h) = homogMech%get_asInt('N_constituents')
case default case default
call IO_error(500,ext_msg=trim(tag)) call IO_error(500,ext_msg=homogMech%get_asString('type'))
end select end select
homogenization_typeInstance(h) = count(homogenization_type==homogenization_type(h)) homogenization_typeInstance(h) = count(homogenization_type==homogenization_type(h))
if (config_homogenization(h)%keyExists('thermal')) then if(homog%contains('thermal')) then
thermal_initialT(h) = config_homogenization(h)%getFloat('t0',defaultVal=300.0_pReal) homogThermal => homog%get('thermal')
thermal_initialT(h) = homogThermal%get_asFloat('T_0',defaultVal=300.0_pReal)
tag = config_homogenization(h)%getString('thermal')
select case (trim(tag))
case(THERMAL_isothermal_label)
thermal_type(h) = THERMAL_isothermal_ID
case(THERMAL_adiabatic_label)
thermal_type(h) = THERMAL_adiabatic_ID
case(THERMAL_conduction_label)
thermal_type(h) = THERMAL_conduction_ID
case default
call IO_error(500,ext_msg=trim(tag))
end select
select case (homogThermal%get_asString('type'))
case('isothermal')
thermal_type(h) = THERMAL_isothermal_ID
case('adiabatic')
thermal_type(h) = THERMAL_adiabatic_ID
case('conduction')
thermal_type(h) = THERMAL_conduction_ID
case default
call IO_error(500,ext_msg=homogThermal%get_asString('type'))
end select
endif endif
if (config_homogenization(h)%keyExists('damage')) then if(homog%contains('damage')) then
damage_initialPhi(h) = config_homogenization(h)%getFloat('initialdamage',defaultVal=1.0_pReal) homogDamage => homog%get('damage')
damage_initialPhi(h) = homogDamage%get_asFloat('phi_0',defaultVal=1.0_pReal)
tag = config_homogenization(h)%getString('damage') select case (homogDamage%get_asString('type'))
select case (trim(tag)) case('none')
case(DAMAGE_NONE_label) damage_type(h) = DAMAGE_none_ID
damage_type(h) = DAMAGE_none_ID case('local')
case(DAMAGE_LOCAL_label) damage_type(h) = DAMAGE_local_ID
damage_type(h) = DAMAGE_local_ID case('nonlocal')
case(DAMAGE_NONLOCAL_label) damage_type(h) = DAMAGE_nonlocal_ID
damage_type(h) = DAMAGE_nonlocal_ID case default
case default call IO_error(500,ext_msg=homogDamage%get_asString('type'))
call IO_error(500,ext_msg=trim(tag)) end select
end select
endif endif
enddo enddo
do h=1, size(config_homogenization) do h=1, material_Nhomogenization
homogenization_typeInstance(h) = count(homogenization_type(1:h) == homogenization_type(h)) homogenization_typeInstance(h) = count(homogenization_type(1:h) == homogenization_type(h))
thermal_typeInstance(h) = count(thermal_type (1:h) == thermal_type (h)) thermal_typeInstance(h) = count(thermal_type (1:h) == thermal_type (h))
damage_typeInstance(h) = count(damage_type (1:h) == damage_type (h)) damage_typeInstance(h) = count(damage_type (1:h) == damage_type (h))
@ -453,6 +319,7 @@ subroutine material_parseHomogenization
homogenization_maxNgrains = maxval(homogenization_Ngrains,homogenization_active) homogenization_maxNgrains = maxval(homogenization_Ngrains,homogenization_active)
end subroutine material_parseHomogenization end subroutine material_parseHomogenization
@ -461,276 +328,101 @@ end subroutine material_parseHomogenization
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
subroutine material_parseMicrostructure subroutine material_parseMicrostructure
character(len=pStringLen), dimension(:), allocatable :: & class(tNode), pointer :: microstructure, & !> pointer to microstructure list
strings constituentsInMicrostructure, & !> pointer to a microstructure list item
integer, allocatable, dimension(:) :: chunkPos constituents, & !> pointer to constituents list
integer :: m, c, i constituent, & !> pointer to each constituent
character(len=pStringLen) :: & phases, &
tag homogenization
integer, dimension(:), allocatable :: &
CounterPhase, &
CounterHomogenization
real(pReal), dimension(:,:), allocatable :: & real(pReal), dimension(:,:), allocatable :: &
microstructure_fraction !< vol fraction of each constituent in microstructure microstructure_fraction !< vol fraction of each constituent in microstrcuture
integer :: & integer :: &
maxNconstituents !< max number of constituents in any phase e, &
i, &
m, &
c, &
microstructure_maxNconstituents
allocate(microstructure_Nconstituents(size(config_microstructure)), source=0) real(pReal), dimension(4) :: phase_orientation
if(any(discretization_microstructureAt > size(config_microstructure))) & homogenization => material_root%get('homogenization')
call IO_error(155,ext_msg='More microstructures in geometry than sections in material.config') phases => material_root%get('phase')
microstructure => material_root%get('microstructure')
allocate(microstructure_Nconstituents(microstructure%length), source = 0)
if(any(discretization_microstructureAt > microstructure%length)) &
call IO_error(155,ext_msg='More microstructures in geometry than sections in material.yaml')
do m=1, size(config_microstructure) do m = 1, microstructure%length
microstructure_Nconstituents(m) = config_microstructure(m)%countKeys('(constituent)') constituentsInMicrostructure => microstructure%get(m)
constituents => constituentsInMicrostructure%get('constituents')
microstructure_Nconstituents(m) = constituents%length
enddo
microstructure_maxNconstituents = maxval(microstructure_Nconstituents)
allocate(microstructure_fraction(microstructure_maxNconstituents,microstructure%length), source =0.0_pReal)
allocate(material_phaseAt(microstructure_maxNconstituents,discretization_nElem), source =0)
allocate(material_orientation0(microstructure_maxNconstituents,discretization_nIP,discretization_nElem))
allocate(material_homogenizationAt(discretization_nElem))
allocate(material_homogenizationMemberAt(discretization_nIP,discretization_nElem),source=0)
allocate(material_phaseMemberAt(microstructure_maxNconstituents,discretization_nIP,discretization_nElem),source=0)
allocate(CounterPhase(phases%length),source=0)
allocate(CounterHomogenization(homogenization%length),source=0)
do m = 1, microstructure%length
constituentsInMicrostructure => microstructure%get(m)
constituents => constituentsInMicrostructure%get('constituents')
do c = 1, constituents%length
constituent => constituents%get(c)
microstructure_fraction(c,m) = constituent%get_asFloat('fraction')
enddo
if (dNeq(sum(microstructure_fraction(:,m)),1.0_pReal)) call IO_error(153,ext_msg='constituent')
enddo enddo
maxNconstituents = maxval(microstructure_Nconstituents) do e = 1, discretization_nElem
allocate(microstructure_phase (maxNconstituents,size(config_microstructure)),source=0) do i = 1, discretization_nIP
allocate(microstructure_texture (maxNconstituents,size(config_microstructure)),source=0) constituentsInMicrostructure => microstructure%get(discretization_microstructureAt(e))
allocate(microstructure_fraction(maxNconstituents,size(config_microstructure)),source=0.0_pReal) constituents => constituentsInMicrostructure%get('constituents')
do c = 1, constituents%length
allocate(strings(1)) ! Intel 16.0 Bug constituent => constituents%get(c)
do m=1, size(config_microstructure) material_phaseAt(c,e) = phases%getIndex(constituent%get_asString('phase'))
strings = config_microstructure(m)%getStrings('(constituent)',raw=.true.) phase_orientation = constituent%get_asFloats('orientation')
do c = 1, size(strings) call material_orientation0(c,i,e)%fromQuaternion(phase_orientation)
chunkPos = IO_stringPos(strings(c)) enddo
enddo
do i = 1,5,2 enddo
tag = IO_stringValue(strings(c),chunkPos,i)
do e = 1, discretization_nElem
select case (tag) do i = 1, discretization_nIP
case('phase') constituentsInMicrostructure => microstructure%get(discretization_microstructureAt(e))
microstructure_phase(c,m) = IO_intValue(strings(c),chunkPos,i+1) material_homogenizationAt(e) = homogenization%getIndex(constituentsInMicrostructure%get_asString('homogenization'))
case('texture') CounterHomogenization(material_homogenizationAt(e)) = CounterHomogenization(material_homogenizationAt(e)) + 1
microstructure_texture(c,m) = IO_intValue(strings(c),chunkPos,i+1) material_homogenizationMemberAt(i,e) = CounterHomogenization(material_homogenizationAt(e))
case('fraction') enddo
microstructure_fraction(c,m) = IO_floatValue(strings(c),chunkPos,i+1) enddo
end select
do e = 1, discretization_nElem
do i = 1, discretization_nIP
constituentsInMicrostructure => microstructure%get(discretization_microstructureAt(e))
constituents => constituentsInMicrostructure%get('constituents')
do c = 1, constituents%length
CounterPhase(material_phaseAt(c,e)) = &
CounterPhase(material_phaseAt(c,e)) + 1
material_phaseMemberAt(c,i,e) = CounterPhase(material_phaseAt(c,e))
enddo enddo
enddo enddo
if (dNeq(sum(microstructure_fraction(:,m)),1.0_pReal)) call IO_error(153,ext_msg=config_name_microstructure(m))
enddo enddo
end subroutine material_parseMicrostructure end subroutine material_parseMicrostructure
!--------------------------------------------------------------------------------------------------
!> @brief parses the phase part in the material configuration file
!--------------------------------------------------------------------------------------------------
subroutine material_parsePhase
integer :: sourceCtr, kinematicsCtr, stiffDegradationCtr, p
character(len=pStringLen), dimension(:), allocatable :: str
allocate(phase_elasticity(size(config_phase)),source=ELASTICITY_undefined_ID)
allocate(phase_plasticity(size(config_phase)),source=PLASTICITY_undefined_ID)
allocate(phase_Nsources(size(config_phase)), source=0)
allocate(phase_Nkinematics(size(config_phase)), source=0)
allocate(phase_NstiffnessDegradations(size(config_phase)),source=0)
allocate(phase_localPlasticity(size(config_phase)), source=.false.)
do p=1, size(config_phase)
phase_Nsources(p) = config_phase(p)%countKeys('(source)')
phase_Nkinematics(p) = config_phase(p)%countKeys('(kinematics)')
phase_NstiffnessDegradations(p) = config_phase(p)%countKeys('(stiffness_degradation)')
phase_localPlasticity(p) = .not. config_phase(p)%KeyExists('/nonlocal/')
select case (config_phase(p)%getString('elasticity'))
case (ELASTICITY_HOOKE_label)
phase_elasticity(p) = ELASTICITY_HOOKE_ID
case default
call IO_error(200,ext_msg=trim(config_phase(p)%getString('elasticity')))
end select
select case (config_phase(p)%getString('plasticity'))
case (PLASTICITY_NONE_label)
phase_plasticity(p) = PLASTICITY_NONE_ID
case (PLASTICITY_ISOTROPIC_label)
phase_plasticity(p) = PLASTICITY_ISOTROPIC_ID
case (PLASTICITY_PHENOPOWERLAW_label)
phase_plasticity(p) = PLASTICITY_PHENOPOWERLAW_ID
case (PLASTICITY_KINEHARDENING_label)
phase_plasticity(p) = PLASTICITY_KINEHARDENING_ID
case (PLASTICITY_DISLOTWIN_label)
phase_plasticity(p) = PLASTICITY_DISLOTWIN_ID
case (PLASTICITY_DISLOUCLA_label)
phase_plasticity(p) = PLASTICITY_DISLOUCLA_ID
case (PLASTICITY_NONLOCAL_label)
phase_plasticity(p) = PLASTICITY_NONLOCAL_ID
case default
call IO_error(201,ext_msg=trim(config_phase(p)%getString('plasticity')))
end select
enddo
allocate(phase_source(maxval(phase_Nsources),size(config_phase)), source=SOURCE_undefined_ID)
allocate(phase_kinematics(maxval(phase_Nkinematics),size(config_phase)), source=KINEMATICS_undefined_ID)
allocate(phase_stiffnessDegradation(maxval(phase_NstiffnessDegradations),size(config_phase)), &
source=STIFFNESS_DEGRADATION_undefined_ID)
do p=1, size(config_phase)
#if defined(__GFORTRAN__) || defined(__PGI)
str = ['GfortranBug86277']
str = config_phase(p)%getStrings('(source)',defaultVal=str)
if (str(1) == 'GfortranBug86277') str = [character(len=pStringLen)::]
#else
str = config_phase(p)%getStrings('(source)',defaultVal=[character(len=pStringLen)::])
#endif
do sourceCtr = 1, size(str)
select case (trim(str(sourceCtr)))
case (SOURCE_thermal_dissipation_label)
phase_source(sourceCtr,p) = SOURCE_thermal_dissipation_ID
case (SOURCE_thermal_externalheat_label)
phase_source(sourceCtr,p) = SOURCE_thermal_externalheat_ID
case (SOURCE_damage_isoBrittle_label)
phase_source(sourceCtr,p) = SOURCE_damage_isoBrittle_ID
case (SOURCE_damage_isoDuctile_label)
phase_source(sourceCtr,p) = SOURCE_damage_isoDuctile_ID
case (SOURCE_damage_anisoBrittle_label)
phase_source(sourceCtr,p) = SOURCE_damage_anisoBrittle_ID
case (SOURCE_damage_anisoDuctile_label)
phase_source(sourceCtr,p) = SOURCE_damage_anisoDuctile_ID
end select
enddo
#if defined(__GFORTRAN__) || defined(__PGI)
str = ['GfortranBug86277']
str = config_phase(p)%getStrings('(kinematics)',defaultVal=str)
if (str(1) == 'GfortranBug86277') str = [character(len=pStringLen)::]
#else
str = config_phase(p)%getStrings('(kinematics)',defaultVal=[character(len=pStringLen)::])
#endif
do kinematicsCtr = 1, size(str)
select case (trim(str(kinematicsCtr)))
case (KINEMATICS_cleavage_opening_label)
phase_kinematics(kinematicsCtr,p) = KINEMATICS_cleavage_opening_ID
case (KINEMATICS_slipplane_opening_label)
phase_kinematics(kinematicsCtr,p) = KINEMATICS_slipplane_opening_ID
case (KINEMATICS_thermal_expansion_label)
phase_kinematics(kinematicsCtr,p) = KINEMATICS_thermal_expansion_ID
end select
enddo
#if defined(__GFORTRAN__) || defined(__PGI)
str = ['GfortranBug86277']
str = config_phase(p)%getStrings('(stiffness_degradation)',defaultVal=str)
if (str(1) == 'GfortranBug86277') str = [character(len=pStringLen)::]
#else
str = config_phase(p)%getStrings('(stiffness_degradation)',defaultVal=[character(len=pStringLen)::])
#endif
do stiffDegradationCtr = 1, size(str)
select case (trim(str(stiffDegradationCtr)))
case (STIFFNESS_DEGRADATION_damage_label)
phase_stiffnessDegradation(stiffDegradationCtr,p) = STIFFNESS_DEGRADATION_damage_ID
end select
enddo
enddo
allocate(phase_plasticityInstance(size(config_phase)),source=0)
allocate(phase_elasticityInstance(size(config_phase)),source=0)
do p=1, size(config_phase)
phase_elasticityInstance(p) = count(phase_elasticity(1:p) == phase_elasticity(p))
phase_plasticityInstance(p) = count(phase_plasticity(1:p) == phase_plasticity(p))
enddo
end subroutine material_parsePhase
!--------------------------------------------------------------------------------------------------
!> @brief parses the texture part in the material configuration file
!--------------------------------------------------------------------------------------------------
subroutine material_parseTexture
integer :: j,t
character(len=pStringLen), dimension(:), allocatable :: strings ! Values for given key in material config
integer, dimension(:), allocatable :: chunkPos
real(pReal), dimension(3,3) :: transformation ! maps texture to microstructure coordinate system
real(pReal), dimension(3) :: Eulers ! Euler angles in degrees from file
type(rotation) :: transformation_
do t=1, size(config_texture)
if (config_texture(t)%countKeys('(gauss)') /= 1) call IO_error(147,ext_msg='count((gauss)) != 1')
if (config_texture(t)%keyExists('symmetry')) call IO_error(147,ext_msg='symmetry')
if (config_texture(t)%keyExists('(random)')) call IO_error(147,ext_msg='(random)')
if (config_texture(t)%keyExists('(fiber)')) call IO_error(147,ext_msg='(fiber)')
enddo
allocate(texture_orientation(size(config_texture)))
do t=1, size(config_texture)
strings = config_texture(t)%getStrings('(gauss)',raw= .true.)
chunkPos = IO_stringPos(strings(1))
do j = 1,5,2
select case (IO_stringValue(strings(1),chunkPos,j))
case('phi1')
Eulers(1) = IO_floatValue(strings(1),chunkPos,j+1)
case('phi')
Eulers(2) = IO_floatValue(strings(1),chunkPos,j+1)
case('phi2')
Eulers(3) = IO_floatValue(strings(1),chunkPos,j+1)
end select
enddo
call texture_orientation(t)%fromEulers(Eulers,degrees=.true.)
if (config_texture(t)%keyExists('axes')) then
strings = config_texture(t)%getStrings('axes')
do j = 1, 3 ! look for "x", "y", and "z" entries
select case (strings(j))
case('x', '+x')
transformation(j,1:3) = [ 1.0_pReal, 0.0_pReal, 0.0_pReal] ! original axis is now +x-axis
case('-x')
transformation(j,1:3) = [-1.0_pReal, 0.0_pReal, 0.0_pReal] ! original axis is now -x-axis
case('y', '+y')
transformation(j,1:3) = [ 0.0_pReal, 1.0_pReal, 0.0_pReal] ! original axis is now +y-axis
case('-y')
transformation(j,1:3) = [ 0.0_pReal,-1.0_pReal, 0.0_pReal] ! original axis is now -y-axis
case('z', '+z')
transformation(j,1:3) = [ 0.0_pReal, 0.0_pReal, 1.0_pReal] ! original axis is now +z-axis
case('-z')
transformation(j,1:3) = [ 0.0_pReal, 0.0_pReal,-1.0_pReal] ! original axis is now -z-axis
case default
call IO_error(157,t)
end select
enddo
call transformation_%fromMatrix(transformation)
texture_orientation(t) = texture_orientation(t) * transformation_
endif
enddo
end subroutine material_parseTexture
!--------------------------------------------------------------------------------------------------
!> @brief Allocate the components of the state structure for a given phase
!--------------------------------------------------------------------------------------------------
subroutine material_allocateState(state, &
NipcMyPhase,sizeState,sizeDotState,sizeDeltaState)
class(tState), intent(out) :: &
state
integer, intent(in) :: &
NipcMyPhase, &
sizeState, &
sizeDotState, &
sizeDeltaState
state%sizeState = sizeState
state%sizeDotState = sizeDotState
state%sizeDeltaState = sizeDeltaState
state%offsetDeltaState = sizeState-sizeDeltaState ! deltaState occupies latter part of state by definition
allocate(state%atol (sizeState), source=0.0_pReal)
allocate(state%state0 (sizeState,NipcMyPhase), source=0.0_pReal)
allocate(state%partionedState0(sizeState,NipcMyPhase), source=0.0_pReal)
allocate(state%subState0 (sizeState,NipcMyPhase), source=0.0_pReal)
allocate(state%state (sizeState,NipcMyPhase), source=0.0_pReal)
allocate(state%dotState (sizeDotState,NipcMyPhase), source=0.0_pReal)
allocate(state%deltaState(sizeDeltaState,NipcMyPhase), source=0.0_pReal)
end subroutine material_allocateState
end module material end module material

View File

@ -8,7 +8,7 @@
module math module math
use prec use prec
use IO use IO
use numerics use config
use YAML_types use YAML_types
use LAPACK_interface use LAPACK_interface
@ -18,8 +18,7 @@ module math
! do not make use associated entities available to other modules ! do not make use associated entities available to other modules
private :: & private :: &
prec, & prec, &
IO, & IO
numerics
#endif #endif
real(pReal), parameter :: PI = acos(-1.0_pReal) !< ratio of a circle's circumference to its diameter real(pReal), parameter :: PI = acos(-1.0_pReal) !< ratio of a circle's circumference to its diameter

View File

@ -15,7 +15,7 @@ program DAMASK_mesh
use math use math
use CPFEM2 use CPFEM2
use FEsolving use FEsolving
use numerics use config
use discretization_mesh use discretization_mesh
use FEM_Utilities use FEM_Utilities
use mesh_mech_FEM use mesh_mech_FEM

View File

@ -14,8 +14,7 @@ module FEM_utilities
use prec use prec
use FEsolving use FEsolving
use homogenization use homogenization
use numerics use config
use debug
use math use math
use discretization_mesh use discretization_mesh

View File

@ -14,9 +14,8 @@ module discretization_mesh
use DAMASK_interface use DAMASK_interface
use IO use IO
use debug use config
use discretization use discretization
use numerics
use FEsolving use FEsolving
use FEM_quadrature use FEM_quadrature
use YAML_types use YAML_types

View File

@ -18,7 +18,8 @@ module mesh_mech_FEM
use FEM_utilities use FEM_utilities
use discretization_mesh use discretization_mesh
use DAMASK_interface use DAMASK_interface
use numerics use config
use IO
use FEM_quadrature use FEM_quadrature
use homogenization use homogenization
use math use math

View File

@ -1,82 +0,0 @@
!--------------------------------------------------------------------------------------------------
!> @author Franz Roters, Max-Planck-Institut für Eisenforschung GmbH
!> @author Philip Eisenlohr, Max-Planck-Institut für Eisenforschung GmbH
!> @author Sharan Roongta, Max-Planck-Institut für Eisenforschung GmbH
!> @brief Managing of parameters related to numerics
!--------------------------------------------------------------------------------------------------
module numerics
use prec
use IO
use YAML_types
use YAML_parse
#ifdef PETSc
#include <petsc/finclude/petscsys.h>
use petscsys
#endif
!$ use OMP_LIB
implicit none
private
class(tNode), pointer, protected, public :: &
numerics_root !< root pointer storing the numerics YAML structure
integer, protected, public :: &
worldrank = 0, & !< MPI worldrank (/=0 for MPI simulations only)
worldsize = 1 !< MPI worldsize (/=1 for MPI simulations only)
integer(4), protected, public :: &
DAMASK_NumThreadsInt = 0 !< value stored in environment variable DAMASK_NUM_THREADS, set to zero if no OpenMP directive
public :: numerics_init
contains
!--------------------------------------------------------------------------------------------------
!> @brief reads in parameters from numerics.config and sets openMP related parameters. Also does
! a sanity check
!--------------------------------------------------------------------------------------------------
subroutine numerics_init
!$ integer :: gotDAMASK_NUM_THREADS = 1
integer :: ierr
character(len=:), allocatable :: &
numerics_input, &
numerics_inFlow
logical :: fexist
!$ character(len=6) DAMASK_NumThreadsString ! environment variable DAMASK_NUM_THREADS
#ifdef PETSc
call MPI_Comm_rank(PETSC_COMM_WORLD,worldrank,ierr);CHKERRQ(ierr)
call MPI_Comm_size(PETSC_COMM_WORLD,worldsize,ierr);CHKERRQ(ierr)
#endif
write(6,'(/,a)') ' <<<+- numerics init -+>>>'
!$ call GET_ENVIRONMENT_VARIABLE(NAME='DAMASK_NUM_THREADS',VALUE=DAMASK_NumThreadsString,STATUS=gotDAMASK_NUM_THREADS) ! get environment variable DAMASK_NUM_THREADS...
!$ if(gotDAMASK_NUM_THREADS /= 0) then ! could not get number of threads, set it to 1
!$ call IO_warning(35,ext_msg='BEGIN:'//DAMASK_NumThreadsString//':END')
!$ DAMASK_NumThreadsInt = 1_4
!$ else
!$ read(DAMASK_NumThreadsString,'(i6)') DAMASK_NumThreadsInt ! read as integer
!$ if (DAMASK_NumThreadsInt < 1_4) DAMASK_NumThreadsInt = 1_4 ! in case of string conversion fails, set it to one
!$ endif
!$ call omp_set_num_threads(DAMASK_NumThreadsInt) ! set number of threads for parallel execution
numerics_root => emptyDict
inquire(file='numerics.yaml', exist=fexist)
if (fexist) then
write(6,'(a,/)') ' using values from config file'
flush(6)
numerics_input = IO_read('numerics.yaml')
numerics_inFlow = to_flow(numerics_input)
numerics_root => parse_flow(numerics_inFlow)
endif
!--------------------------------------------------------------------------------------------------
! openMP parameter
!$ write(6,'(a24,1x,i8,/)') ' number of threads: ',DAMASK_NumThreadsInt
end subroutine numerics_init
end module numerics

View File

@ -7,7 +7,7 @@
module results module results
use DAMASK_interface use DAMASK_interface
use rotations use rotations
use numerics use config
use HDF5_utilities use HDF5_utilities
#ifdef PETSc #ifdef PETSc
use PETSC use PETSC

View File

@ -56,7 +56,7 @@ module rotations
private private
type, public :: rotation type, public :: rotation
type(quaternion), private :: q type(quaternion) :: q
contains contains
procedure, public :: asQuaternion procedure, public :: asQuaternion
procedure, public :: asEulers procedure, public :: asEulers

View File

@ -12,15 +12,15 @@ submodule (constitutive:constitutive_damage) source_damage_anisoBrittle
type :: tParameters !< container type for internal constitutive parameters type :: tParameters !< container type for internal constitutive parameters
real(pReal) :: & real(pReal) :: &
sdot_0, & sdot_0, & !< opening rate of cleavage planes
n n !< damage rate sensitivity
real(pReal), dimension(:), allocatable :: & real(pReal), dimension(:), allocatable :: &
critDisp, & critDisp, & !< critical displacement
critLoad critLoad !< critical load
real(pReal), dimension(:,:,:,:), allocatable :: & real(pReal), dimension(:,:,:,:), allocatable :: &
cleavage_systems cleavage_systems
integer :: & integer :: &
sum_N_cl sum_N_cl !< total number of cleavage planes
character(len=pStringLen), allocatable, dimension(:) :: & character(len=pStringLen), allocatable, dimension(:) :: &
output output
end type tParameters end type tParameters
@ -35,72 +35,87 @@ contains
!> @brief module initialization !> @brief module initialization
!> @details reads in material parameters, allocates arrays, and does sanity checks !> @details reads in material parameters, allocates arrays, and does sanity checks
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
module subroutine source_damage_anisoBrittle_init module function source_damage_anisoBrittle_init(source_length) result(mySources)
integer, intent(in) :: source_length
logical, dimension(:,:), allocatable :: mySources
class(tNode), pointer :: &
phases, &
phase, &
sources, &
src
integer :: Ninstance,sourceOffset,NipcMyPhase,p integer :: Ninstance,sourceOffset,NipcMyPhase,p
integer, dimension(:), allocatable :: N_cl integer, dimension(:), allocatable :: N_cl
character(len=pStringLen) :: extmsg = '' character(len=pStringLen) :: extmsg = ''
write(6,'(/,a)') ' <<<+- source_'//SOURCE_DAMAGE_ANISOBRITTLE_LABEL//' init -+>>>' write(6,'(/,a)') ' <<<+- source_damage_anisoBrittle init -+>>>'
Ninstance = count(phase_source == SOURCE_DAMAGE_ANISOBRITTLE_ID) mySources = source_active('damage_anisoBrittle',source_length)
Ninstance = count(mySources)
write(6,'(a16,1x,i5,/)') '# instances:',Ninstance; flush(6) write(6,'(a16,1x,i5,/)') '# instances:',Ninstance; flush(6)
if(Ninstance == 0) return
allocate(source_damage_anisoBrittle_offset (size(config_phase)), source=0) phases => material_root%get('phase')
allocate(source_damage_anisoBrittle_instance(size(config_phase)), source=0)
allocate(param(Ninstance)) allocate(param(Ninstance))
allocate(source_damage_anisoBrittle_offset (phases%length), source=0)
allocate(source_damage_anisoBrittle_instance(phases%length), source=0)
do p = 1, size(config_phase) do p = 1, phases%length
source_damage_anisoBrittle_instance(p) = count(phase_source(:,1:p) == SOURCE_DAMAGE_ANISOBRITTLE_ID) phase => phases%get(p)
do sourceOffset = 1, phase_Nsources(p) if(any(mySources(:,p))) source_damage_anisoBrittle_instance(p) = count(mySources(:,1:p))
if (phase_source(sourceOffset,p) == SOURCE_DAMAGE_ANISOBRITTLE_ID) then if(count(mySources(:,p)) == 0) cycle
sources => phase%get('source')
do sourceOffset = 1, sources%length
if(mySources(sourceOffset,p)) then
source_damage_anisoBrittle_offset(p) = sourceOffset source_damage_anisoBrittle_offset(p) = sourceOffset
exit associate(prm => param(source_damage_anisoBrittle_instance(p)))
endif src => sources%get(sourceOffset)
enddo
N_cl = src%get_asInts('N_cl',defaultVal=emptyIntArray)
prm%sum_N_cl = sum(abs(N_cl))
prm%n = src%get_asFloat('q')
prm%sdot_0 = src%get_asFloat('dot_o')
prm%critDisp = src%get_asFloats('s_crit', requiredSize=size(N_cl))
prm%critLoad = src%get_asFloats('g_crit', requiredSize=size(N_cl))
prm%cleavage_systems = lattice_SchmidMatrix_cleavage(N_cl,phase%get_asString('lattice'),&
phase%get_asFloat('c/a',defaultVal=0.0_pReal))
! expand: family => system
prm%critDisp = math_expand(prm%critDisp,N_cl)
prm%critLoad = math_expand(prm%critLoad,N_cl)
if (all(phase_source(:,p) /= SOURCE_DAMAGE_ANISOBRITTLE_ID)) cycle #if defined (__GFORTRAN__)
associate(prm => param(source_damage_anisoBrittle_instance(p)), & prm%output = output_asStrings(src)
config => config_phase(p)) #else
prm%output = src%get_asStrings('output',defaultVal=emptyStringArray)
#endif
! sanity checks
if (prm%n <= 0.0_pReal) extmsg = trim(extmsg)//' q'
if (prm%sdot_0 <= 0.0_pReal) extmsg = trim(extmsg)//' dot_o'
if (any(prm%critLoad < 0.0_pReal)) extmsg = trim(extmsg)//' g_crit'
if (any(prm%critDisp < 0.0_pReal)) extmsg = trim(extmsg)//' s_crit'
prm%output = config%getStrings('(output)',defaultVal=emptyStringArray) NipcMyPhase = count(material_phaseAt==p) * discretization_nIP
call constitutive_allocateState(sourceState(p)%p(sourceOffset),NipcMyPhase,1,1,0)
sourceState(p)%p(sourceOffset)%atol = src%get_asFloat('anisobrittle_atol',defaultVal=1.0e-3_pReal)
if(any(sourceState(p)%p(sourceOffset)%atol < 0.0_pReal)) extmsg = trim(extmsg)//' anisobrittle_atol'
N_cl = config%getInts('ncleavage',defaultVal=emptyIntArray) end associate
prm%sum_N_cl = sum(abs(N_cl))
prm%n = config%getFloat('anisobrittle_ratesensitivity')
prm%sdot_0 = config%getFloat('anisobrittle_sdot0')
prm%critDisp = config%getFloats('anisobrittle_criticaldisplacement',requiredSize=size(N_cl))
prm%critLoad = config%getFloats('anisobrittle_criticalload', requiredSize=size(N_cl))
prm%cleavage_systems = lattice_SchmidMatrix_cleavage(N_cl,config%getString('lattice_structure'),&
config%getFloat('c/a',defaultVal=0.0_pReal))
! expand: family => system
prm%critDisp = math_expand(prm%critDisp,N_cl)
prm%critLoad = math_expand(prm%critLoad,N_cl)
! sanity checks
if (prm%n <= 0.0_pReal) extmsg = trim(extmsg)//' anisobrittle_n'
if (prm%sdot_0 <= 0.0_pReal) extmsg = trim(extmsg)//' anisobrittle_sdot0'
if (any(prm%critLoad < 0.0_pReal)) extmsg = trim(extmsg)//' anisobrittle_critLoad'
if (any(prm%critDisp < 0.0_pReal)) extmsg = trim(extmsg)//' anisobrittle_critDisp'
NipcMyPhase = count(material_phaseAt==p) * discretization_nIP
call material_allocateState(sourceState(p)%p(sourceOffset),NipcMyPhase,1,1,0)
sourceState(p)%p(sourceOffset)%atol = config%getFloat('anisobrittle_atol',defaultVal=1.0e-3_pReal)
if(any(sourceState(p)%p(sourceOffset)%atol < 0.0_pReal)) extmsg = trim(extmsg)//' anisobrittle_atol'
end associate
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! exit if any parameter is out of range ! exit if any parameter is out of range
if (extmsg /= '') call IO_error(211,ext_msg=trim(extmsg)//'('//SOURCE_DAMAGE_ANISOBRITTLE_LABEL//')') if (extmsg /= '') call IO_error(211,ext_msg=trim(extmsg)//'(damage_anisoBrittle)')
endif
enddo
enddo
enddo end function source_damage_anisoBrittle_init
end subroutine source_damage_anisoBrittle_init
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
@ -193,8 +208,8 @@ module subroutine source_damage_anisoBrittle_results(phase,group)
stt => sourceState(phase)%p(source_damage_anisoBrittle_offset(phase))%state) stt => sourceState(phase)%p(source_damage_anisoBrittle_offset(phase))%state)
outputsLoop: do o = 1,size(prm%output) outputsLoop: do o = 1,size(prm%output)
select case(trim(prm%output(o))) select case(trim(prm%output(o)))
case ('anisobrittle_drivingforce') case ('f_phi')
call results_writeDataset(group,stt,'tbd','driving force','tbd') call results_writeDataset(group,stt,trim(prm%output(o)),'driving force','J/m³')
end select end select
enddo outputsLoop enddo outputsLoop
end associate end associate

View File

@ -10,16 +10,16 @@ submodule(constitutive:constitutive_damage) source_damage_anisoDuctile
source_damage_anisoDuctile_offset, & !< which source is my current damage mechanism? source_damage_anisoDuctile_offset, & !< which source is my current damage mechanism?
source_damage_anisoDuctile_instance !< instance of damage source mechanism source_damage_anisoDuctile_instance !< instance of damage source mechanism
type :: tParameters !< container type for internal constitutive parameters type :: tParameters !< container type for internal constitutive parameters
real(pReal) :: & real(pReal) :: &
n n !< damage rate sensitivity
real(pReal), dimension(:), allocatable :: & real(pReal), dimension(:), allocatable :: &
critPlasticStrain critPlasticStrain !< critical plastic strain per slip system
character(len=pStringLen), allocatable, dimension(:) :: & character(len=pStringLen), allocatable, dimension(:) :: &
output output
end type tParameters end type tParameters
type(tParameters), dimension(:), allocatable :: param !< containers of constitutive parameters (len Ninstance) type(tParameters), dimension(:), allocatable :: param !< containers of constitutive parameters (len Ninstance)
contains contains
@ -28,61 +28,80 @@ contains
!> @brief module initialization !> @brief module initialization
!> @details reads in material parameters, allocates arrays, and does sanity checks !> @details reads in material parameters, allocates arrays, and does sanity checks
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
module subroutine source_damage_anisoDuctile_init module function source_damage_anisoDuctile_init(source_length) result(mySources)
integer, intent(in) :: source_length
logical, dimension(:,:), allocatable :: mySources
class(tNode), pointer :: &
phases, &
phase, &
pl, &
sources, &
src
integer :: Ninstance,sourceOffset,NipcMyPhase,p integer :: Ninstance,sourceOffset,NipcMyPhase,p
integer, dimension(:), allocatable :: N_sl integer, dimension(:), allocatable :: N_sl
character(len=pStringLen) :: extmsg = '' character(len=pStringLen) :: extmsg = ''
write(6,'(/,a)') ' <<<+- source_'//SOURCE_DAMAGE_ANISODUCTILE_LABEL//' init -+>>>' write(6,'(/,a)') ' <<<+- source_damage_anisoDuctile init -+>>>'
Ninstance = count(phase_source == SOURCE_DAMAGE_ANISODUCTILE_ID) mySources = source_active('damage_anisoDuctile',source_length)
Ninstance = count(mySources)
write(6,'(a16,1x,i5,/)') '# instances:',Ninstance; flush(6) write(6,'(a16,1x,i5,/)') '# instances:',Ninstance; flush(6)
allocate(source_damage_anisoDuctile_offset (size(config_phase)), source=0) if(Ninstance == 0) return
allocate(source_damage_anisoDuctile_instance(size(config_phase)), source=0)
phases => material_root%get('phase')
allocate(param(Ninstance)) allocate(param(Ninstance))
allocate(source_damage_anisoDuctile_offset (phases%length), source=0)
allocate(source_damage_anisoDuctile_instance(phases%length), source=0)
do p = 1, size(config_phase) do p = 1, phases%length
source_damage_anisoDuctile_instance(p) = count(phase_source(:,1:p) == SOURCE_DAMAGE_ANISODUCTILE_ID) phase => phases%get(p)
do sourceOffset = 1, phase_Nsources(p) if(any(mySources(:,p))) source_damage_anisoDuctile_instance(p) = count(mySources(:,1:p))
if (phase_source(sourceOffset,p) == SOURCE_DAMAGE_ANISODUCTILE_ID) then if(count(mySources(:,p)) == 0) cycle
sources => phase%get('source')
pl => phase%get('plasticity')
do sourceOffset = 1, sources%length
if(mySources(sourceOffset,p)) then
source_damage_anisoDuctile_offset(p) = sourceOffset source_damage_anisoDuctile_offset(p) = sourceOffset
exit associate(prm => param(source_damage_anisoDuctile_instance(p)))
endif src => sources%get(sourceOffset)
enddo
if (all(phase_source(:,p) /= SOURCE_DAMAGE_ANISODUCTILE_ID)) cycle N_sl = pl%get_asInts('N_sl',defaultVal=emptyIntArray)
associate(prm => param(source_damage_anisoDuctile_instance(p)), & prm%n = src%get_asFloat('q')
config => config_phase(p)) prm%critPlasticStrain = src%get_asFloats('gamma_crit',requiredSize=size(N_sl))
prm%output = config%getStrings('(output)',defaultVal=emptyStringArray) ! expand: family => system
prm%critPlasticStrain = math_expand(prm%critPlasticStrain,N_sl)
N_sl = config%getInts('nslip',defaultVal=emptyIntArray) #if defined (__GFORTRAN__)
prm%n = config%getFloat('anisoductile_ratesensitivity') prm%output = output_asStrings(src)
prm%critPlasticStrain = config%getFloats('anisoductile_criticalplasticstrain',requiredSize=size(N_sl)) #else
prm%output = src%get_asStrings('output',defaultVal=emptyStringArray)
#endif
! sanity checks
if (prm%n <= 0.0_pReal) extmsg = trim(extmsg)//' q'
if (any(prm%critPlasticStrain < 0.0_pReal)) extmsg = trim(extmsg)//' gamma_crit'
! expand: family => system NipcMyPhase=count(material_phaseAt==p) * discretization_nIP
prm%critPlasticStrain = math_expand(prm%critPlasticStrain,N_sl) call constitutive_allocateState(sourceState(p)%p(sourceOffset),NipcMyPhase,1,1,0)
sourceState(p)%p(sourceOffset)%atol = src%get_asFloat('anisoDuctile_atol',defaultVal=1.0e-3_pReal)
if(any(sourceState(p)%p(sourceOffset)%atol < 0.0_pReal)) extmsg = trim(extmsg)//' anisoductile_atol'
! sanity checks end associate
if (prm%n <= 0.0_pReal) extmsg = trim(extmsg)//' anisoductile_ratesensitivity'
if (any(prm%critPlasticStrain < 0.0_pReal)) extmsg = trim(extmsg)//' anisoductile_criticalplasticstrain'
NipcMyPhase=count(material_phaseAt==p) * discretization_nIP
call material_allocateState(sourceState(p)%p(sourceOffset),NipcMyPhase,1,1,0)
sourceState(p)%p(sourceOffset)%atol = config%getFloat('anisoductile_atol',defaultVal=1.0e-3_pReal)
if(any(sourceState(p)%p(sourceOffset)%atol < 0.0_pReal)) extmsg = trim(extmsg)//' anisoductile_atol'
end associate
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! exit if any parameter is out of range ! exit if any parameter is out of range
if (extmsg /= '') call IO_error(211,ext_msg=trim(extmsg)//'('//SOURCE_DAMAGE_ANISODUCTILE_LABEL//')') if (extmsg /= '') call IO_error(211,ext_msg=trim(extmsg)//'(damage_anisoDuctile)')
endif
enddo
enddo
enddo
end subroutine source_damage_anisoDuctile_init end function source_damage_anisoDuctile_init
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
@ -157,8 +176,8 @@ module subroutine source_damage_anisoDuctile_results(phase,group)
stt => sourceState(phase)%p(source_damage_anisoDuctile_offset(phase))%state) stt => sourceState(phase)%p(source_damage_anisoDuctile_offset(phase))%state)
outputsLoop: do o = 1,size(prm%output) outputsLoop: do o = 1,size(prm%output)
select case(trim(prm%output(o))) select case(trim(prm%output(o)))
case ('anisoductile_drivingforce') case ('f_phi')
call results_writeDataset(group,stt,'tbd','driving force','tbd') call results_writeDataset(group,stt,trim(prm%output(o)),'driving force','J/m³')
end select end select
enddo outputsLoop enddo outputsLoop
end associate end associate

View File

@ -10,10 +10,10 @@ submodule(constitutive:constitutive_damage) source_damage_isoBrittle
source_damage_isoBrittle_offset, & source_damage_isoBrittle_offset, &
source_damage_isoBrittle_instance source_damage_isoBrittle_instance
type :: tParameters !< container type for internal constitutive parameters type :: tParameters !< container type for internal constitutive parameters
real(pReal) :: & real(pReal) :: &
critStrainEnergy, & critStrainEnergy, & !< critical elastic strain energy
N N
character(len=pStringLen), allocatable, dimension(:) :: & character(len=pStringLen), allocatable, dimension(:) :: &
output output
end type tParameters end type tParameters
@ -27,56 +27,72 @@ contains
!> @brief module initialization !> @brief module initialization
!> @details reads in material parameters, allocates arrays, and does sanity checks !> @details reads in material parameters, allocates arrays, and does sanity checks
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
module subroutine source_damage_isoBrittle_init module function source_damage_isoBrittle_init(source_length) result(mySources)
integer, intent(in) :: source_length
logical, dimension(:,:), allocatable :: mySources
class(tNode), pointer :: &
phases, &
phase, &
sources, &
src
integer :: Ninstance,sourceOffset,NipcMyPhase,p integer :: Ninstance,sourceOffset,NipcMyPhase,p
character(len=pStringLen) :: extmsg = '' character(len=pStringLen) :: extmsg = ''
write(6,'(/,a)') ' <<<+- source_'//SOURCE_DAMAGE_ISOBRITTLE_LABEL//' init -+>>>' write(6,'(/,a)') ' <<<+- source_damage_isoBrittle init -+>>>'
Ninstance = count(phase_source == SOURCE_DAMAGE_ISOBRITTLE_ID) mySources = source_active('damage_isoBrittle',source_length)
Ninstance = count(mySources)
write(6,'(a16,1x,i5,/)') '# instances:',Ninstance; flush(6) write(6,'(a16,1x,i5,/)') '# instances:',Ninstance; flush(6)
if(Ninstance == 0) return
allocate(source_damage_isoBrittle_offset (size(config_phase)), source=0) phases => material_root%get('phase')
allocate(source_damage_isoBrittle_instance(size(config_phase)), source=0)
allocate(param(Ninstance)) allocate(param(Ninstance))
allocate(source_damage_isoBrittle_offset (phases%length), source=0)
allocate(source_damage_isoBrittle_instance(phases%length), source=0)
do p = 1, size(config_phase) do p = 1, phases%length
source_damage_isoBrittle_instance(p) = count(phase_source(:,1:p) == SOURCE_DAMAGE_ISOBRITTLE_ID) phase => phases%get(p)
do sourceOffset = 1, phase_Nsources(p) if(any(mySources(:,p))) source_damage_isoBrittle_instance(p) = count(mySources(:,1:p))
if (phase_source(sourceOffset,p) == SOURCE_DAMAGE_ISOBRITTLE_ID) then if(count(mySources(:,p)) == 0) cycle
sources => phase%get('source')
do sourceOffset = 1, sources%length
if(mySources(sourceOffset,p)) then
source_damage_isoBrittle_offset(p) = sourceOffset source_damage_isoBrittle_offset(p) = sourceOffset
exit associate(prm => param(source_damage_isoBrittle_instance(p)))
endif src => sources%get(sourceOffset)
enddo
if (all(phase_source(:,p) /= SOURCE_DAMAGE_ISOBRITTLE_ID)) cycle prm%N = src%get_asFloat('m')
associate(prm => param(source_damage_isoBrittle_instance(p)), & prm%critStrainEnergy = src%get_asFloat('W_crit')
config => config_phase(p))
prm%output = config%getStrings('(output)',defaultVal=emptyStringArray) #if defined (__GFORTRAN__)
prm%output = output_asStrings(src)
#else
prm%output = src%get_asStrings('output',defaultVal=emptyStringArray)
#endif
! sanity checks
if (prm%N <= 0.0_pReal) extmsg = trim(extmsg)//' m'
if (prm%critStrainEnergy <= 0.0_pReal) extmsg = trim(extmsg)//' W_crit'
prm%N = config%getFloat('isobrittle_n') NipcMyPhase = count(material_phaseAt==p) * discretization_nIP
prm%critStrainEnergy = config%getFloat('isobrittle_criticalstrainenergy') call constitutive_allocateState(sourceState(p)%p(sourceOffset),NipcMyPhase,1,1,1)
sourceState(p)%p(sourceOffset)%atol = src%get_asFloat('isoBrittle_atol',defaultVal=1.0e-3_pReal)
if(any(sourceState(p)%p(sourceOffset)%atol < 0.0_pReal)) extmsg = trim(extmsg)//' isobrittle_atol'
! sanity checks end associate
if (prm%N <= 0.0_pReal) extmsg = trim(extmsg)//' isobrittle_n'
if (prm%critStrainEnergy <= 0.0_pReal) extmsg = trim(extmsg)//' isobrittle_criticalstrainenergy'
NipcMyPhase = count(material_phaseAt==p) * discretization_nIP
call material_allocateState(sourceState(p)%p(sourceOffset),NipcMyPhase,1,1,1)
sourceState(p)%p(sourceOffset)%atol = config%getFloat('isobrittle_atol',defaultVal=1.0e-3_pReal)
if(any(sourceState(p)%p(sourceOffset)%atol < 0.0_pReal)) extmsg = trim(extmsg)//' isobrittle_atol'
end associate
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! exit if any parameter is out of range ! exit if any parameter is out of range
if (extmsg /= '') call IO_error(211,ext_msg=trim(extmsg)//'('//SOURCE_DAMAGE_ISOBRITTLE_LABEL//')') if (extmsg /= '') call IO_error(211,ext_msg=trim(extmsg)//'(damage_isoBrittle)')
endif
enddo
enddo
enddo
end subroutine source_damage_isoBrittle_init end function source_damage_isoBrittle_init
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
@ -168,8 +184,8 @@ module subroutine source_damage_isoBrittle_results(phase,group)
stt => sourceState(phase)%p(source_damage_isoBrittle_offset(phase))%state) stt => sourceState(phase)%p(source_damage_isoBrittle_offset(phase))%state)
outputsLoop: do o = 1,size(prm%output) outputsLoop: do o = 1,size(prm%output)
select case(trim(prm%output(o))) select case(trim(prm%output(o)))
case ('isobrittle_drivingforce') case ('f_phi')
call results_writeDataset(group,stt,'tbd','driving force','tbd') call results_writeDataset(group,stt,trim(prm%output(o)),'driving force','J/m³')
end select end select
enddo outputsLoop enddo outputsLoop
end associate end associate

View File

@ -10,15 +10,15 @@ submodule (constitutive:constitutive_damage) source_damage_isoDuctile
source_damage_isoDuctile_offset, & !< which source is my current damage mechanism? source_damage_isoDuctile_offset, & !< which source is my current damage mechanism?
source_damage_isoDuctile_instance !< instance of damage source mechanism source_damage_isoDuctile_instance !< instance of damage source mechanism
type:: tParameters !< container type for internal constitutive parameters type:: tParameters !< container type for internal constitutive parameters
real(pReal) :: & real(pReal) :: &
critPlasticStrain, & critPlasticStrain, & !< critical plastic strain
N N
character(len=pStringLen), allocatable, dimension(:) :: & character(len=pStringLen), allocatable, dimension(:) :: &
output output
end type tParameters end type tParameters
type(tParameters), dimension(:), allocatable :: param !< containers of constitutive parameters (len Ninstance) type(tParameters), dimension(:), allocatable :: param !< containers of constitutive parameters (len Ninstance)
contains contains
@ -28,56 +28,72 @@ contains
!> @brief module initialization !> @brief module initialization
!> @details reads in material parameters, allocates arrays, and does sanity checks !> @details reads in material parameters, allocates arrays, and does sanity checks
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
module subroutine source_damage_isoDuctile_init module function source_damage_isoDuctile_init(source_length) result(mySources)
integer, intent(in) :: source_length
logical, dimension(:,:), allocatable :: mySources
class(tNode), pointer :: &
phases, &
phase, &
sources, &
src
integer :: Ninstance,sourceOffset,NipcMyPhase,p integer :: Ninstance,sourceOffset,NipcMyPhase,p
character(len=pStringLen) :: extmsg = '' character(len=pStringLen) :: extmsg = ''
write(6,'(/,a)') ' <<<+- source_'//SOURCE_DAMAGE_ISODUCTILE_LABEL//' init -+>>>' write(6,'(/,a)') ' <<<+- source_damage_isoDuctile init -+>>>'
Ninstance = count(phase_source == SOURCE_DAMAGE_ISODUCTILE_ID) mySources = source_active('damage_isoDuctile',source_length)
Ninstance = count(mySources)
write(6,'(a16,1x,i5,/)') '# instances:',Ninstance; flush(6) write(6,'(a16,1x,i5,/)') '# instances:',Ninstance; flush(6)
if(Ninstance == 0) return
allocate(source_damage_isoDuctile_offset (size(config_phase)), source=0) phases => material_root%get('phase')
allocate(source_damage_isoDuctile_instance(size(config_phase)), source=0)
allocate(param(Ninstance)) allocate(param(Ninstance))
allocate(source_damage_isoDuctile_offset (phases%length), source=0)
allocate(source_damage_isoDuctile_instance(phases%length), source=0)
do p = 1, size(config_phase) do p = 1, phases%length
source_damage_isoDuctile_instance(p) = count(phase_source(:,1:p) == SOURCE_DAMAGE_ISODUCTILE_ID) phase => phases%get(p)
do sourceOffset = 1, phase_Nsources(p) if(count(mySources(:,p)) == 0) cycle
if (phase_source(sourceOffset,p) == SOURCE_DAMAGE_ISODUCTILE_ID) then if(any(mySources(:,p))) source_damage_isoDuctile_instance(p) = count(mySources(:,1:p))
sources => phase%get('source')
do sourceOffset = 1, sources%length
if(mySources(sourceOffset,p)) then
source_damage_isoDuctile_offset(p) = sourceOffset source_damage_isoDuctile_offset(p) = sourceOffset
exit associate(prm => param(source_damage_isoDuctile_instance(p)))
endif src => sources%get(sourceOffset)
enddo
if (all(phase_source(:,p) /= SOURCE_DAMAGE_ISODUCTILE_ID)) cycle prm%N = src%get_asFloat('q')
associate(prm => param(source_damage_isoDuctile_instance(p)), & prm%critPlasticStrain = src%get_asFloat('gamma_crit')
config => config_phase(p))
prm%output = config%getStrings('(output)',defaultVal=emptyStringArray) #if defined (__GFORTRAN__)
prm%output = output_asStrings(src)
#else
prm%output = src%get_asStrings('output',defaultVal=emptyStringArray)
#endif
! sanity checks
if (prm%N <= 0.0_pReal) extmsg = trim(extmsg)//' q'
if (prm%critPlasticStrain <= 0.0_pReal) extmsg = trim(extmsg)//' gamma_crit'
prm%N = config%getFloat('isoductile_ratesensitivity') NipcMyPhase=count(material_phaseAt==p) * discretization_nIP
prm%critPlasticStrain = config%getFloat('isoductile_criticalplasticstrain') call constitutive_allocateState(sourceState(p)%p(sourceOffset),NipcMyPhase,1,1,0)
sourceState(p)%p(sourceOffset)%atol = src%get_asFloat('isoDuctile_atol',defaultVal=1.0e-3_pReal)
if(any(sourceState(p)%p(sourceOffset)%atol < 0.0_pReal)) extmsg = trim(extmsg)//' isoductile_atol'
! sanity checks end associate
if (prm%N <= 0.0_pReal) extmsg = trim(extmsg)//' isoductile_ratesensitivity'
if (prm%critPlasticStrain <= 0.0_pReal) extmsg = trim(extmsg)//' isoductile_criticalplasticstrain'
NipcMyPhase=count(material_phaseAt==p) * discretization_nIP
call material_allocateState(sourceState(p)%p(sourceOffset),NipcMyPhase,1,1,0)
sourceState(p)%p(sourceOffset)%atol = config%getFloat('isoductile_atol',defaultVal=1.0e-3_pReal)
if(any(sourceState(p)%p(sourceOffset)%atol < 0.0_pReal)) extmsg = trim(extmsg)//' isoductile_atol'
end associate
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! exit if any parameter is out of range ! exit if any parameter is out of range
if (extmsg /= '') call IO_error(211,ext_msg=trim(extmsg)//'('//SOURCE_DAMAGE_ISODUCTILE_LABEL//')') if (extmsg /= '') call IO_error(211,ext_msg=trim(extmsg)//'(damage_isoDuctile)')
endif
enddo
enddo
enddo
end subroutine source_damage_isoDuctile_init end function source_damage_isoDuctile_init
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
@ -152,8 +168,8 @@ module subroutine source_damage_isoDuctile_results(phase,group)
stt => sourceState(phase)%p(source_damage_isoDuctile_offset(phase))%state) stt => sourceState(phase)%p(source_damage_isoDuctile_offset(phase))%state)
outputsLoop: do o = 1,size(prm%output) outputsLoop: do o = 1,size(prm%output)
select case(trim(prm%output(o))) select case(trim(prm%output(o)))
case ('isoductile_drivingforce') case ('f_phi')
call results_writeDataset(group,stt,'tbd','driving force','tbd') call results_writeDataset(group,stt,trim(prm%output(o)),'driving force','J/m³')
end select end select
enddo outputsLoop enddo outputsLoop
end associate end associate

View File

@ -12,7 +12,7 @@ submodule(constitutive:constitutive_thermal) source_thermal_dissipation
type :: tParameters !< container type for internal constitutive parameters type :: tParameters !< container type for internal constitutive parameters
real(pReal) :: & real(pReal) :: &
kappa kappa !< TAYLOR-QUINNEY factor
end type tParameters end type tParameters
type(tParameters), dimension(:), allocatable :: param !< containers of constitutive parameters (len Ninstance) type(tParameters), dimension(:), allocatable :: param !< containers of constitutive parameters (len Ninstance)
@ -25,41 +25,53 @@ contains
!> @brief module initialization !> @brief module initialization
!> @details reads in material parameters, allocates arrays, and does sanity checks !> @details reads in material parameters, allocates arrays, and does sanity checks
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
module subroutine source_thermal_dissipation_init module function source_thermal_dissipation_init(source_length) result(mySources)
integer, intent(in) :: source_length
logical, dimension(:,:), allocatable :: mySources
class(tNode), pointer :: &
phases, &
phase, &
sources, &
src
integer :: Ninstance,sourceOffset,NipcMyPhase,p integer :: Ninstance,sourceOffset,NipcMyPhase,p
write(6,'(/,a)') ' <<<+- source_'//SOURCE_thermal_dissipation_label//' init -+>>>' write(6,'(/,a)') ' <<<+- source_thermal_dissipation init -+>>>'
Ninstance = count(phase_source == SOURCE_THERMAL_DISSIPATION_ID) mySources = source_active('thermal_dissipation',source_length)
Ninstance = count(mySources)
write(6,'(a16,1x,i5,/)') '# instances:',Ninstance; flush(6) write(6,'(a16,1x,i5,/)') '# instances:',Ninstance; flush(6)
if(Ninstance == 0) return
allocate(source_thermal_dissipation_offset (size(config_phase)), source=0) phases => material_root%get('phase')
allocate(source_thermal_dissipation_instance(size(config_phase)), source=0)
allocate(param(Ninstance)) allocate(param(Ninstance))
allocate(source_thermal_dissipation_offset (phases%length), source=0)
allocate(source_thermal_dissipation_instance(phases%length), source=0)
do p = 1, size(config_phase) do p = 1, phases%length
source_thermal_dissipation_instance(p) = count(phase_source(:,1:p) == SOURCE_THERMAL_DISSIPATION_ID) phase => phases%get(p)
do sourceOffset = 1, phase_Nsources(p) if(count(mySources(:,p)) == 0) cycle
if (phase_source(sourceOffset,p) == SOURCE_THERMAL_DISSIPATION_ID) then if(any(mySources(:,p))) source_thermal_dissipation_instance(p) = count(mySources(:,1:p))
sources => phase%get('source')
do sourceOffset = 1, sources%length
if(mySources(sourceOffset,p)) then
source_thermal_dissipation_offset(p) = sourceOffset source_thermal_dissipation_offset(p) = sourceOffset
exit associate(prm => param(source_thermal_dissipation_instance(p)))
src => sources%get(sourceOffset)
prm%kappa = src%get_asFloat('kappa')
NipcMyPhase = count(material_phaseAt==p) * discretization_nIP
call constitutive_allocateState(sourceState(p)%p(sourceOffset),NipcMyPhase,0,0,0)
end associate
endif endif
enddo enddo
if (all(phase_source(:,p) /= SOURCE_THERMAL_DISSIPATION_ID)) cycle
associate(prm => param(source_thermal_dissipation_instance(p)), &
config => config_phase(p))
prm%kappa = config%getFloat('dissipation_coldworkcoeff')
NipcMyPhase = count(material_phaseAt==p) * discretization_nIP
call material_allocateState(sourceState(p)%p(sourceOffset),NipcMyPhase,0,0,0)
end associate
enddo enddo
end subroutine source_thermal_dissipation_init
end function source_thermal_dissipation_init
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------

View File

@ -11,9 +11,9 @@ submodule(constitutive:constitutive_thermal) source_thermal_externalheat
source_thermal_externalheat_offset, & !< which source is my current thermal dissipation mechanism? source_thermal_externalheat_offset, & !< which source is my current thermal dissipation mechanism?
source_thermal_externalheat_instance !< instance of thermal dissipation source mechanism source_thermal_externalheat_instance !< instance of thermal dissipation source mechanism
type :: tParameters !< container type for internal constitutive parameters type :: tParameters !< container type for internal constitutive parameters
real(pReal), dimension(:), allocatable :: & real(pReal), dimension(:), allocatable :: &
time, & time, &
heat_rate heat_rate
integer :: & integer :: &
nIntervals nIntervals
@ -29,44 +29,56 @@ contains
!> @brief module initialization !> @brief module initialization
!> @details reads in material parameters, allocates arrays, and does sanity checks !> @details reads in material parameters, allocates arrays, and does sanity checks
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
module subroutine source_thermal_externalheat_init module function source_thermal_externalheat_init(source_length) result(mySources)
integer, intent(in) :: source_length
logical, dimension(:,:), allocatable :: mySources
class(tNode), pointer :: &
phases, &
phase, &
sources, &
src
integer :: Ninstance,sourceOffset,NipcMyPhase,p integer :: Ninstance,sourceOffset,NipcMyPhase,p
write(6,'(/,a)') ' <<<+- source_'//SOURCE_thermal_externalheat_label//' init -+>>>' write(6,'(/,a)') ' <<<+- source_thermal_externalHeat init -+>>>'
Ninstance = count(phase_source == SOURCE_thermal_externalheat_ID) mySources = source_active('thermal_externalheat',source_length)
Ninstance = count(mySources)
write(6,'(a16,1x,i5,/)') '# instances:',Ninstance; flush(6) write(6,'(a16,1x,i5,/)') '# instances:',Ninstance; flush(6)
if(Ninstance == 0) return
allocate(source_thermal_externalheat_offset (size(config_phase)), source=0) phases => material_root%get('phase')
allocate(source_thermal_externalheat_instance(size(config_phase)), source=0)
allocate(param(Ninstance)) allocate(param(Ninstance))
allocate(source_thermal_externalheat_offset (phases%length), source=0)
allocate(source_thermal_externalheat_instance(phases%length), source=0)
do p = 1, size(config_phase) do p = 1, phases%length
source_thermal_externalheat_instance(p) = count(phase_source(:,1:p) == SOURCE_thermal_externalheat_ID) phase => phases%get(p)
do sourceOffset = 1, phase_Nsources(p) if(any(mySources(:,p))) source_thermal_externalheat_instance(p) = count(mySources(:,1:p))
if (phase_source(sourceOffset,p) == SOURCE_thermal_externalheat_ID) then if(count(mySources(:,p)) == 0) cycle
sources => phase%get('source')
do sourceOffset = 1, sources%length
if(mySources(sourceOffset,p)) then
source_thermal_externalheat_offset(p) = sourceOffset source_thermal_externalheat_offset(p) = sourceOffset
exit associate(prm => param(source_thermal_externalheat_instance(p)))
src => sources%get(sourceOffset)
prm%time = src%get_asFloats('t_n')
prm%nIntervals = size(prm%time) - 1
prm%heat_rate = src%get_asFloats('f_T',requiredSize = size(prm%time))
NipcMyPhase = count(material_phaseAt==p) * discretization_nIP
call constitutive_allocateState(sourceState(p)%p(sourceOffset),NipcMyPhase,1,1,0)
end associate
endif endif
enddo enddo
if (all(phase_source(:,p) /= SOURCE_thermal_externalheat_ID)) cycle
associate(prm => param(source_thermal_externalheat_instance(p)), &
config => config_phase(p))
prm%time = config%getFloats('externalheat_time')
prm%nIntervals = size(prm%time) - 1
prm%heat_rate = config%getFloats('externalheat_rate',requiredSize = size(prm%time))
NipcMyPhase = count(material_phaseAt==p) * discretization_nIP
call material_allocateState(sourceState(p)%p(sourceOffset),NipcMyPhase,1,1,0)
end associate
enddo enddo
end subroutine source_thermal_externalheat_init end function source_thermal_externalheat_init
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------

View File

@ -5,10 +5,10 @@
module thermal_adiabatic module thermal_adiabatic
use prec use prec
use config use config
use numerics
use material use material
use results use results
use constitutive use constitutive
use YAML_types
use crystallite use crystallite
use lattice use lattice
@ -40,20 +40,32 @@ contains
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
subroutine thermal_adiabatic_init subroutine thermal_adiabatic_init
integer :: maxNinstance,h,NofMyHomog integer :: maxNinstance,h,NofMyHomog
class(tNode), pointer :: &
write(6,'(/,a)') ' <<<+- thermal_'//THERMAL_ADIABATIC_label//' init -+>>>'; flush(6) material_homogenization, &
homog, &
homogThermal
write(6,'(/,a)') ' <<<+- thermal_adiabatic init -+>>>'; flush(6)
maxNinstance = count(thermal_type == THERMAL_adiabatic_ID) maxNinstance = count(thermal_type == THERMAL_adiabatic_ID)
if (maxNinstance == 0) return if (maxNinstance == 0) return
allocate(param(maxNinstance)) allocate(param(maxNinstance))
do h = 1, size(thermal_type) material_homogenization => material_root%get('homogenization')
do h = 1, material_Nhomogenization
if (thermal_type(h) /= THERMAL_adiabatic_ID) cycle if (thermal_type(h) /= THERMAL_adiabatic_ID) cycle
associate(prm => param(thermal_typeInstance(h)),config => config_homogenization(h)) homog => material_homogenization%get(h)
homogThermal => homog%get('thermal')
prm%output = config%getStrings('(output)',defaultVal=emptyStringArray)
associate(prm => param(thermal_typeInstance(h)))
#if defined (__GFORTRAN__)
prm%output = output_asStrings(homogThermal)
#else
prm%output = homogThermal%get_asStrings('output',defaultVal=emptyStringArray)
#endif
NofMyHomog=count(material_homogenizationAt==h) NofMyHomog=count(material_homogenizationAt==h)
thermalState(h)%sizeState = 1 thermalState(h)%sizeState = 1
@ -205,7 +217,7 @@ subroutine thermal_adiabatic_results(homog,group)
associate(prm => param(damage_typeInstance(homog))) associate(prm => param(damage_typeInstance(homog)))
outputsLoop: do o = 1,size(prm%output) outputsLoop: do o = 1,size(prm%output)
select case(trim(prm%output(o))) select case(trim(prm%output(o)))
case('temperature') ! ToDo: should be 'T' case('T')
call results_writeDataset(group,temperature(homog)%p,'T',& call results_writeDataset(group,temperature(homog)%p,'T',&
'temperature','K') 'temperature','K')
end select end select

View File

@ -10,6 +10,7 @@ module thermal_conduction
use results use results
use crystallite use crystallite
use constitutive use constitutive
use YAML_types
implicit none implicit none
private private
@ -41,17 +42,28 @@ contains
subroutine thermal_conduction_init subroutine thermal_conduction_init
integer :: Ninstance,NofMyHomog,h integer :: Ninstance,NofMyHomog,h
class(tNode), pointer :: &
write(6,'(/,a)') ' <<<+- thermal_'//THERMAL_CONDUCTION_label//' init -+>>>'; flush(6) material_homogenization, &
homog, &
homogThermal
write(6,'(/,a)') ' <<<+- thermal_conduction init -+>>>'; flush(6)
Ninstance = count(thermal_type == THERMAL_conduction_ID) Ninstance = count(thermal_type == THERMAL_conduction_ID)
allocate(param(Ninstance)) allocate(param(Ninstance))
do h = 1, size(config_homogenization) material_homogenization => material_root%get('homogenization')
do h = 1, material_Nhomogenization
if (thermal_type(h) /= THERMAL_conduction_ID) cycle if (thermal_type(h) /= THERMAL_conduction_ID) cycle
associate(prm => param(thermal_typeInstance(h)),config => config_homogenization(h)) homog => material_homogenization%get(h)
homogThermal => homog%get('thermal')
associate(prm => param(thermal_typeInstance(h)))
prm%output = config%getStrings('(output)',defaultVal=emptyStringArray) #if defined (__GFORTRAN__)
prm%output = output_asStrings(homogThermal)
#else
prm%output = homogThermal%get_asStrings('output',defaultVal=emptyStringArray)
#endif
NofMyHomog=count(material_homogenizationAt==h) NofMyHomog=count(material_homogenizationAt==h)
thermalState(h)%sizeState = 0 thermalState(h)%sizeState = 0
@ -213,7 +225,7 @@ subroutine thermal_conduction_results(homog,group)
associate(prm => param(damage_typeInstance(homog))) associate(prm => param(damage_typeInstance(homog)))
outputsLoop: do o = 1,size(prm%output) outputsLoop: do o = 1,size(prm%output)
select case(trim(prm%output(o))) select case(trim(prm%output(o)))
case('temperature') ! ToDo: should be 'T' case('T')
call results_writeDataset(group,temperature(homog)%p,'T',& call results_writeDataset(group,temperature(homog)%p,'T',&
'temperature','K') 'temperature','K')
end select end select

View File

@ -18,9 +18,9 @@ subroutine thermal_isothermal_init
integer :: h,NofMyHomog integer :: h,NofMyHomog
write(6,'(/,a)') ' <<<+- thermal_'//THERMAL_isothermal_label//' init -+>>>'; flush(6) write(6,'(/,a)') ' <<<+- thermal_isothermal init -+>>>'; flush(6)
do h = 1, size(config_homogenization) do h = 1, material_Nhomogenization
if (thermal_type(h) /= THERMAL_isothermal_ID) cycle if (thermal_type(h) /= THERMAL_isothermal_ID) cycle
NofMyHomog = count(material_homogenizationAt == h) NofMyHomog = count(material_homogenizationAt == h)