From 14ce127dc405fee3a0c66d6adf805614ebd8e947 Mon Sep 17 00:00:00 2001 From: Sharan Roongta Date: Thu, 4 Feb 2021 13:46:01 +0100 Subject: [PATCH 01/60] fraction --> v --- PRIVATE | 2 +- .../SpectralMethod/Polycrystal/material.yaml | 40 +++++++++---------- python/damask/_configmaterial.py | 14 +++---- .../reference/ConfigMaterial/material.yaml | 10 ++--- python/tests/test_ConfigMaterial.py | 2 +- src/material.f90 | 2 +- 6 files changed, 35 insertions(+), 35 deletions(-) diff --git a/PRIVATE b/PRIVATE index f3cd8f4c4..3f915ee49 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit f3cd8f4c4b2d154e179d9bb5f396a77535f88556 +Subproject commit 3f915ee49eb7e5e26d4b9b5e5712de9e05e64d83 diff --git a/examples/SpectralMethod/Polycrystal/material.yaml b/examples/SpectralMethod/Polycrystal/material.yaml index b560a919d..e54eec436 100644 --- a/examples/SpectralMethod/Polycrystal/material.yaml +++ b/examples/SpectralMethod/Polycrystal/material.yaml @@ -8,102 +8,102 @@ material: - homogenization: SX constituents: - phase: Aluminum - fraction: 1.0 + v: 1.0 O: [1.0, 0.0, 0.0, 0.0] - homogenization: SX constituents: - phase: Aluminum - fraction: 1.0 + v: 1.0 O: [0.7936696712125002, -0.28765777461664166, -0.3436487135089419, 0.4113964260949434] - homogenization: SX constituents: - phase: Aluminum - fraction: 1.0 + v: 1.0 O: [0.3986143167493579, -0.7014883552495493, 0.2154871765709027, 0.5500781677772945] - homogenization: SX constituents: - phase: Aluminum - fraction: 1.0 + v: 1.0 O: [0.28645844315788244, -0.022571491243423537, -0.467933059311115, -0.8357456192708106] - homogenization: SX constituents: - phase: Aluminum - fraction: 1.0 + v: 1.0 O: [0.33012772942625784, -0.6781865350268957, 0.6494525351030648, 0.09638521992649676] - homogenization: SX constituents: - phase: Aluminum - fraction: 1.0 + v: 1.0 O: [0.43596817439583935, -0.5982537129781701, 0.046599032277502436, 0.6707106499919265] - homogenization: SX constituents: - phase: Aluminum - fraction: 1.0 + v: 1.0 O: [0.169734823419553, -0.699615227367322, -0.6059581215838098, -0.33844257746495854] - homogenization: SX constituents: - phase: Aluminum - fraction: 1.0 + v: 1.0 O: [0.9698864809294915, 0.1729052643205874, -0.15948307917616958, 0.06315956884687175] - homogenization: SX constituents: - phase: Aluminum - fraction: 1.0 + v: 1.0 O: [0.46205660912967883, 0.3105054068891252, -0.617849551030653, 0.555294529545738] - homogenization: SX constituents: - phase: Aluminum - fraction: 1.0 + v: 1.0 O: [0.4512443497461787, -0.7636045534540555, -0.04739348426715133, -0.45939142396805815] - homogenization: SX constituents: - phase: Aluminum - fraction: 1.0 + v: 1.0 O: [0.2161856212656443, -0.6581450184826598, -0.5498086209601588, 0.4667112513346289] - homogenization: SX constituents: - phase: Aluminum - fraction: 1.0 + v: 1.0 O: [0.8753220715350803, -0.4561599367657419, -0.13298279533852678, -0.08969369719975541] - homogenization: SX constituents: - phase: Aluminum - fraction: 1.0 + v: 1.0 O: [0.11908260752431069, 0.18266024809834172, -0.7144822594012615, -0.664807992845101] - homogenization: SX constituents: - phase: Aluminum - fraction: 1.0 + v: 1.0 O: [0.751104669484278, 0.5585633382623958, -0.34579336397009175, 0.06538900566860861] - homogenization: SX constituents: - phase: Aluminum - fraction: 1.0 + v: 1.0 O: [0.08740438971703973, 0.8991264096610437, -0.4156704205935976, 0.10559485570696363] - homogenization: SX constituents: - phase: Aluminum - fraction: 1.0 + v: 1.0 O: [0.5584325870096193, 0.6016408353068798, -0.14280340445801173, 0.5529814994483859] - homogenization: SX constituents: - phase: Aluminum - fraction: 1.0 + v: 1.0 O: [0.4052725440888093, 0.25253073423599154, 0.5693263597910454, -0.669215876471182] - homogenization: SX constituents: - phase: Aluminum - fraction: 1.0 + v: 1.0 O: [0.7570164606888676, 0.15265448024694664, -0.5998021466848317, 0.20942796551297105] - homogenization: SX constituents: - phase: Aluminum - fraction: 1.0 + v: 1.0 O: [0.6987659297138081, -0.132172211261028, -0.19693254724422338, 0.6748883269678543] - homogenization: SX constituents: - phase: Aluminum - fraction: 1.0 + v: 1.0 O: [0.7729330445886478, 0.21682179052722322, -0.5207379472917645, 0.2905078484066341] phase: diff --git a/python/damask/_configmaterial.py b/python/damask/_configmaterial.py index 6415ee4dc..d3ed972e3 100644 --- a/python/damask/_configmaterial.py +++ b/python/damask/_configmaterial.py @@ -74,12 +74,12 @@ class ConfigMaterial(Config): material: - constituents: - O: [0.19, 0.8, 0.24, -0.51] - fraction: 1.0 + v: 1.0 phase: Aluminum homogenization: SX - constituents: - O: [0.8, 0.19, 0.24, -0.51] - fraction: 1.0 + v: 1.0 phase: Steel homogenization: SX homogenization: {} @@ -172,7 +172,7 @@ class ConfigMaterial(Config): if 'constituents' in v: f = 0.0 for c in v['constituents']: - f+= float(c['fraction']) + f+= float(c['v']) if 'O' in c: try: Rotation.from_quaternion(c['O']) @@ -257,17 +257,17 @@ class ConfigMaterial(Config): material: - constituents: - O: [0.577764, -0.146299, -0.617669, 0.513010] - fraction: 1.0 + v: 1.0 phase: Aluminum homogenization: SX - constituents: - O: [0.184176, 0.340305, 0.737247, 0.553840] - fraction: 1.0 + v: 1.0 phase: Steel homogenization: SX - constituents: - O: [0.0886257, -0.144848, 0.615674, -0.769487] - fraction: 1.0 + v: 1.0 phase: Aluminum homogenization: SX homogenization: {} @@ -312,7 +312,7 @@ class ConfigMaterial(Config): if hasattr(v,'__len__') and not isinstance(v,str): N_material = len(v) if N == 1: - m = [[{'fraction':1.0}] for _ in range(N_material)] + m = [[{'v':1.0}] for _ in range(N_material)] for k,v in kwargs.items(): if hasattr(v,'__len__') and not isinstance(v,str): if len(v) != N_material: diff --git a/python/tests/reference/ConfigMaterial/material.yaml b/python/tests/reference/ConfigMaterial/material.yaml index fbba6a631..1da30535a 100644 --- a/python/tests/reference/ConfigMaterial/material.yaml +++ b/python/tests/reference/ConfigMaterial/material.yaml @@ -8,25 +8,25 @@ homogenization: material: - constituents: - - fraction: 1.0 + - v: 1.0 O: [1.0, 0.0, 0.0, 0.0] phase: Aluminum homogenization: SX - constituents: - - fraction: 1.0 + - v: 1.0 O: [0.7936696712125002, -0.28765777461664166, -0.3436487135089419, 0.4113964260949434] phase: Aluminum homogenization: SX - constituents: - - fraction: 1.0 + - v: 1.0 O: [0.3986143167493579, -0.7014883552495493, 0.2154871765709027, 0.5500781677772945] phase: Aluminum homogenization: SX - constituents: - - fraction: 0.5 + - v: 0.5 O: [0.28645844315788244, -0.022571491243423537, -0.467933059311115, -0.8357456192708106] phase: Aluminum - - fraction: 0.5 + - v: 0.5 O: [0.3986143167493579, -0.7014883552495493, 0.2154871765709027, 0.5500781677772945] phase: Steel homogenization: Taylor diff --git a/python/tests/test_ConfigMaterial.py b/python/tests/test_ConfigMaterial.py index 45dc3b97f..4ad0d31ca 100644 --- a/python/tests/test_ConfigMaterial.py +++ b/python/tests/test_ConfigMaterial.py @@ -42,7 +42,7 @@ class TestConfigMaterial: def test_invalid_fraction(self,ref_path): material_config = ConfigMaterial.load(ref_path/'material.yaml') - material_config['material'][0]['constituents'][0]['fraction']=.9 + material_config['material'][0]['constituents'][0]['v']=.9 assert not material_config.is_valid @pytest.mark.parametrize('item',['homogenization','phase','material']) diff --git a/src/material.f90 b/src/material.f90 index 5f0f86fe5..3a4c910d9 100644 --- a/src/material.f90 +++ b/src/material.f90 @@ -265,7 +265,7 @@ subroutine material_parseMaterial frac = 0.0_pReal do co = 1, constituents%length constituent => constituents%get(co) - frac = frac + constituent%get_asFloat('fraction') + frac = frac + constituent%get_asFloat('v') material_phaseAt(co,el) = phases%getIndex(constituent%get_asString('phase')) do ip = 1, discretization_nIPs From cab5a5cec7f98fd95a5997cb247451912ea9a951 Mon Sep 17 00:00:00 2001 From: Sharan Roongta Date: Thu, 4 Feb 2021 15:37:40 +0100 Subject: [PATCH 02/60] homogenization 'none' name misleading. --- PRIVATE | 2 +- examples/SpectralMethod/Polycrystal/material.yaml | 2 +- python/tests/reference/ConfigMaterial/material.yaml | 2 +- src/material.f90 | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/PRIVATE b/PRIVATE index 3f915ee49..18dea4a43 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit 3f915ee49eb7e5e26d4b9b5e5712de9e05e64d83 +Subproject commit 18dea4a43c94b04e4c5cc3d193298ef796de7d18 diff --git a/examples/SpectralMethod/Polycrystal/material.yaml b/examples/SpectralMethod/Polycrystal/material.yaml index e54eec436..09176d531 100644 --- a/examples/SpectralMethod/Polycrystal/material.yaml +++ b/examples/SpectralMethod/Polycrystal/material.yaml @@ -2,7 +2,7 @@ homogenization: SX: N_constituents: 1 - mechanics: {type: none} + mechanics: {type: pass} material: - homogenization: SX diff --git a/python/tests/reference/ConfigMaterial/material.yaml b/python/tests/reference/ConfigMaterial/material.yaml index 1da30535a..48ebd98e3 100644 --- a/python/tests/reference/ConfigMaterial/material.yaml +++ b/python/tests/reference/ConfigMaterial/material.yaml @@ -1,7 +1,7 @@ homogenization: SX: N_constituents: 1 - mechanics: {type: none} + mechanics: {type: pass} Taylor: N_constituents: 2 mechanics: {type: isostrain} diff --git a/src/material.f90 b/src/material.f90 index 3a4c910d9..ccc6898be 100644 --- a/src/material.f90 +++ b/src/material.f90 @@ -147,7 +147,7 @@ subroutine material_parseHomogenization homog => material_homogenization%get(h) homogMech => homog%get('mechanics') select case (homogMech%get_asString('type')) - case('none') + case('pass') homogenization_type(h) = HOMOGENIZATION_NONE_ID case('isostrain') homogenization_type(h) = HOMOGENIZATION_ISOSTRAIN_ID From 2e173b4b7b91a8f0867687ad4076204b3f470098 Mon Sep 17 00:00:00 2001 From: Sharan Roongta Date: Thu, 4 Feb 2021 19:17:32 +0100 Subject: [PATCH 03/60] 'estimate_rate' better describes what we want to do than 'drop_guessing' true by default --- PRIVATE | 2 +- src/grid/DAMASK_grid.f90 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/PRIVATE b/PRIVATE index 18dea4a43..2b3f72505 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit 18dea4a43c94b04e4c5cc3d193298ef796de7d18 +Subproject commit 2b3f72505785d717860ab0012da8bc21c7fb61ed diff --git a/src/grid/DAMASK_grid.f90 b/src/grid/DAMASK_grid.f90 index 60c386c75..a9ec6e594 100644 --- a/src/grid/DAMASK_grid.f90 +++ b/src/grid/DAMASK_grid.f90 @@ -227,7 +227,7 @@ program DAMASK_grid loadCases(l)%f_out = step_discretization%get_asInt ('f_out', defaultVal=1) loadCases(l)%f_restart = step_discretization%get_asInt ('f_restart', defaultVal=huge(0)) - loadCases(l)%drop_guessing = (load_step%get_asBool('drop_guessing',defaultVal=.false.) .or. & + loadCases(l)%drop_guessing = (.not. load_step%get_asBool('estimate_rate',defaultVal=.true.) .or. & !ToDO: SR: simplify logic later,change name merge(.false.,.true.,l > 1)) reportAndCheck: if (worldrank == 0) then From a1a7a339d483fbf72e7532c5e99013024b9f242d Mon Sep 17 00:00:00 2001 From: Sharan Roongta Date: Fri, 5 Feb 2021 01:31:41 +0100 Subject: [PATCH 04/60] specify solver,initial and boundary conditions in load file --- PRIVATE | 2 +- .../SpectralMethod/Polycrystal/shearXY.yaml | 21 +++++++--- .../SpectralMethod/Polycrystal/shearZX.yaml | 20 ++++++--- .../SpectralMethod/Polycrystal/tensionX.yaml | 42 +++++++++++-------- src/grid/DAMASK_grid.f90 | 9 ++-- 5 files changed, 60 insertions(+), 34 deletions(-) diff --git a/PRIVATE b/PRIVATE index 2b3f72505..1c2dd13c9 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit 2b3f72505785d717860ab0012da8bc21c7fb61ed +Subproject commit 1c2dd13c9aea21d341e579fe66e4bef5c48ce07e diff --git a/examples/SpectralMethod/Polycrystal/shearXY.yaml b/examples/SpectralMethod/Polycrystal/shearXY.yaml index 559bdfe56..fe746e7ac 100644 --- a/examples/SpectralMethod/Polycrystal/shearXY.yaml +++ b/examples/SpectralMethod/Polycrystal/shearXY.yaml @@ -1,9 +1,18 @@ -step: - - mechanics: - dot_F: [0, 0, 0, - 1e-3, 0, 0, - 0, 0, 0] +--- + +solver: + mechanical: spectral_basic + +initial_conditions: + T: 300 #in Kelvin + +loadstep: + - boundary_conditions: + mechanical: + dot_F: [0, 0, 0, + 1e-3, 0, 0, + 0, 0, 0] discretization: t: 60 N: 120 - f_out: 20 + f_out: 20 diff --git a/examples/SpectralMethod/Polycrystal/shearZX.yaml b/examples/SpectralMethod/Polycrystal/shearZX.yaml index df7b887e5..5d977b4ba 100644 --- a/examples/SpectralMethod/Polycrystal/shearZX.yaml +++ b/examples/SpectralMethod/Polycrystal/shearZX.yaml @@ -1,10 +1,18 @@ --- -step: - - mechanics: - dot_F: [0, 0, 1e-3, - 0, 0, 0, - 0, 0, 0] + +solver: + mechanical: spectral_basic + +initial_conditions: + T: 300 #in Kelvin + +loadstep: + - boundary_conditions: + mechanical: + dot_F: [0, 0, 1e-3, + 0, 0, 0, + 0, 0, 0] discretization: t: 60 N: 120 - f_out: 20 + f_out: 20 diff --git a/examples/SpectralMethod/Polycrystal/tensionX.yaml b/examples/SpectralMethod/Polycrystal/tensionX.yaml index 2f1d11f91..0809fd53d 100644 --- a/examples/SpectralMethod/Polycrystal/tensionX.yaml +++ b/examples/SpectralMethod/Polycrystal/tensionX.yaml @@ -1,25 +1,33 @@ --- -step: - - mechanics: - dot_F: [1.0e-3, 0, 0, - 0, x, 0, - 0, 0, x] - P: [x, x, x, - x, 0, x, - x, x, 0] +solver: + mechanical: spectral_basic + +initial_conditions: + T: 300 #in Kelvin + +loadstep: + - boundary_conditions: + mechanical: + dot_F: [1.0e-3, 0, 0, + 0, x, 0, + 0, 0, x] + P: [x, x, x, + x, 0, x, + x, x, 0] discretization: t: 10 N: 40 - f_out: 4 - - mechanics: - dot_F: [1.0e-3, 0, 0, - 0, x, 0, - 0, 0, x] - P: [x, x, x, - x, 0, x, - x, x, 0] + f_out: 4 + - boundary_conditions: + mechanical: + dot_F: [1.0e-3, 0, 0, + 0, x, 0, + 0, 0, x] + P: [x, x, x, + x, 0, x, + x, x, 0] discretization: t: 60 N: 60 - f_out: 4 + f_out: 4 diff --git a/src/grid/DAMASK_grid.f90 b/src/grid/DAMASK_grid.f90 index a9ec6e594..d49f6f023 100644 --- a/src/grid/DAMASK_grid.f90 +++ b/src/grid/DAMASK_grid.f90 @@ -102,6 +102,7 @@ program DAMASK_grid config_load, & load_steps, & load_step, & + step_bc, & step_mech, & step_discretization, & step_deformation, & @@ -168,7 +169,7 @@ program DAMASK_grid ! reading information from load case file and to sanity checks config_load => YAML_parse_file(trim(interface_loadFile)) - load_steps => config_load%get('step') + load_steps => config_load%get('loadstep') allocate(loadCases(load_steps%length)) ! array of load cases do l = 1, load_steps%length @@ -186,8 +187,8 @@ program DAMASK_grid endif damageActive load_step => load_steps%get(l) - - step_mech => load_step%get('mechanics') + step_bc => load_step%get('boundary_conditions') + step_mech => step_bc%get('mechanical') loadCases(l)%stress%myType='' readMech: do m = 1, step_mech%length select case (step_mech%getKey(m)) @@ -224,9 +225,9 @@ program DAMASK_grid loadCases(l)%t = step_discretization%get_asFloat('t') loadCases(l)%N = step_discretization%get_asInt ('N') loadCases(l)%r = step_discretization%get_asFloat('r', defaultVal= 1.0_pReal) - loadCases(l)%f_out = step_discretization%get_asInt ('f_out', defaultVal=1) loadCases(l)%f_restart = step_discretization%get_asInt ('f_restart', defaultVal=huge(0)) + loadCases(l)%f_out = load_step%get_asInt('f_out', defaultVal=1) loadCases(l)%drop_guessing = (.not. load_step%get_asBool('estimate_rate',defaultVal=.true.) .or. & !ToDO: SR: simplify logic later,change name merge(.false.,.true.,l > 1)) From ba2e8b3c636a9a89450e26d34b5e0b7248f51054 Mon Sep 17 00:00:00 2001 From: Sharan Roongta Date: Fri, 5 Feb 2021 11:57:18 +0100 Subject: [PATCH 05/60] variable name follows label --- src/grid/DAMASK_grid.f90 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/grid/DAMASK_grid.f90 b/src/grid/DAMASK_grid.f90 index d49f6f023..2c9f11285 100644 --- a/src/grid/DAMASK_grid.f90 +++ b/src/grid/DAMASK_grid.f90 @@ -36,7 +36,7 @@ program DAMASK_grid integer :: N, & !< number of increments f_out, & !< frequency of result writes f_restart !< frequency of restart writes - logical :: drop_guessing !< do not follow trajectory of former loadcase + logical :: estimate_rate !< do not follow trajectory of former loadcase integer(kind(FIELD_UNDEFINED_ID)), allocatable :: ID(:) end type tLoadCase @@ -228,13 +228,13 @@ program DAMASK_grid loadCases(l)%f_restart = step_discretization%get_asInt ('f_restart', defaultVal=huge(0)) loadCases(l)%f_out = load_step%get_asInt('f_out', defaultVal=1) - loadCases(l)%drop_guessing = (.not. load_step%get_asBool('estimate_rate',defaultVal=.true.) .or. & !ToDO: SR: simplify logic later,change name - merge(.false.,.true.,l > 1)) + loadCases(l)%estimate_rate = (load_step%get_asBool('estimate_rate',defaultVal=.true.) .and. & + merge(.true.,.false.,l > 1)) reportAndCheck: if (worldrank == 0) then write (loadcase_string, '(i0)' ) l print'(/,a,i0)', ' load case: ', l - print*, ' drop_guessing:', loadCases(l)%drop_guessing + print*, ' estimate_rate:', loadCases(l)%estimate_rate if (loadCases(l)%deformation%myType == 'L') then do j = 1, 3 if (any(loadCases(l)%deformation%mask(j,1:3) .eqv. .true.) .and. & @@ -334,7 +334,7 @@ program DAMASK_grid loadCaseLooping: do l = 1, size(loadCases) time0 = time ! load case start time - guess = .not. loadCases(l)%drop_guessing ! change of load case? homogeneous guess for the first inc + guess = loadCases(l)%estimate_rate ! change of load case? homogeneous guess for the first inc incLooping: do inc = 1, loadCases(l)%N totalIncsCounter = totalIncsCounter + 1 From 8048d69a975c9e3b8dbba78f1843c68c344168b9 Mon Sep 17 00:00:00 2001 From: Franz Roters Date: Fri, 5 Feb 2021 16:59:28 +0100 Subject: [PATCH 06/60] [skip ci] logic inverted --- src/grid/DAMASK_grid.f90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/grid/DAMASK_grid.f90 b/src/grid/DAMASK_grid.f90 index 2c9f11285..7e649ff38 100644 --- a/src/grid/DAMASK_grid.f90 +++ b/src/grid/DAMASK_grid.f90 @@ -36,7 +36,7 @@ program DAMASK_grid integer :: N, & !< number of increments f_out, & !< frequency of result writes f_restart !< frequency of restart writes - logical :: estimate_rate !< do not follow trajectory of former loadcase + logical :: estimate_rate !< follow trajectory of former loadcase integer(kind(FIELD_UNDEFINED_ID)), allocatable :: ID(:) end type tLoadCase From 09c2d7f3f32b81daa6866e6cbca9779115770d13 Mon Sep 17 00:00:00 2001 From: Franz Roters Date: Fri, 5 Feb 2021 17:12:00 +0100 Subject: [PATCH 07/60] updated tests --- PRIVATE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PRIVATE b/PRIVATE index 1c2dd13c9..d90babadf 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit 1c2dd13c9aea21d341e579fe66e4bef5c48ce07e +Subproject commit d90babadfb0a33afa1b793044cc4efd4d7430731 From d5c98bbf62f246e551a0346832a57bd04e023f20 Mon Sep 17 00:00:00 2001 From: Test User Date: Fri, 5 Feb 2021 18:46:17 +0100 Subject: [PATCH 08/60] [skip ci] updated version information after successful test of v3.0.0-alpha2-415-g09c2d7f3f --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index b7d460b2d..b91ec55e4 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v3.0.0-alpha2-407-g47f52b909 +v3.0.0-alpha2-415-g09c2d7f3f From 869307c5ecda89b712267de5103b8c2af16cf220 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 7 Feb 2021 15:05:38 +0100 Subject: [PATCH 09/60] temperature not needed for pure mechanics would also require to define thermal homogenization --- PRIVATE | 2 +- examples/SpectralMethod/Polycrystal/shearXY.yaml | 3 --- examples/SpectralMethod/Polycrystal/shearZX.yaml | 3 --- examples/SpectralMethod/Polycrystal/tensionX.yaml | 3 --- python/damask/_configmaterial.py | 14 +++++++------- 5 files changed, 8 insertions(+), 17 deletions(-) diff --git a/PRIVATE b/PRIVATE index d90babadf..91a4329a6 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit d90babadfb0a33afa1b793044cc4efd4d7430731 +Subproject commit 91a4329a6fe073fc2ef17e5c2c8e2f796e3b897b diff --git a/examples/SpectralMethod/Polycrystal/shearXY.yaml b/examples/SpectralMethod/Polycrystal/shearXY.yaml index fe746e7ac..58471e8f1 100644 --- a/examples/SpectralMethod/Polycrystal/shearXY.yaml +++ b/examples/SpectralMethod/Polycrystal/shearXY.yaml @@ -3,9 +3,6 @@ solver: mechanical: spectral_basic -initial_conditions: - T: 300 #in Kelvin - loadstep: - boundary_conditions: mechanical: diff --git a/examples/SpectralMethod/Polycrystal/shearZX.yaml b/examples/SpectralMethod/Polycrystal/shearZX.yaml index 5d977b4ba..a32fafb85 100644 --- a/examples/SpectralMethod/Polycrystal/shearZX.yaml +++ b/examples/SpectralMethod/Polycrystal/shearZX.yaml @@ -3,9 +3,6 @@ solver: mechanical: spectral_basic -initial_conditions: - T: 300 #in Kelvin - loadstep: - boundary_conditions: mechanical: diff --git a/examples/SpectralMethod/Polycrystal/tensionX.yaml b/examples/SpectralMethod/Polycrystal/tensionX.yaml index 0809fd53d..870755d58 100644 --- a/examples/SpectralMethod/Polycrystal/tensionX.yaml +++ b/examples/SpectralMethod/Polycrystal/tensionX.yaml @@ -3,9 +3,6 @@ solver: mechanical: spectral_basic -initial_conditions: - T: 300 #in Kelvin - loadstep: - boundary_conditions: mechanical: diff --git a/python/damask/_configmaterial.py b/python/damask/_configmaterial.py index d3ed972e3..0adc494b8 100644 --- a/python/damask/_configmaterial.py +++ b/python/damask/_configmaterial.py @@ -168,11 +168,11 @@ class ConfigMaterial(Config): ok = False if 'material' in self: - for i,v in enumerate(self['material']): - if 'constituents' in v: - f = 0.0 - for c in v['constituents']: - f+= float(c['v']) + for i,m in enumerate(self['material']): + if 'constituents' in m: + v = 0.0 + for c in m['constituents']: + v+= float(c['v']) if 'O' in c: try: Rotation.from_quaternion(c['O']) @@ -180,8 +180,8 @@ class ConfigMaterial(Config): o = c['O'] print(f"Invalid orientation: '{o}' in material '{i}'") ok = False - if not np.isclose(f,1.0): - print(f"Invalid total fraction '{f}' in material '{i}'") + if not np.isclose(v,1.0): + print(f"Invalid total fraction (v) '{v}' in material '{i}'") ok = False return ok From 4bcbcb34d00790844d4c00a1b86e1df284af825e Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Tue, 9 Feb 2021 23:34:51 +0100 Subject: [PATCH 10/60] ensures that at least one orientation in the FZ is found --- python/damask/_orientation.py | 24 ++++++++++++------------ python/tests/test_Orientation.py | 11 +++++++++++ 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/python/damask/_orientation.py b/python/damask/_orientation.py index cf31f4089..184315111 100644 --- a/python/damask/_orientation.py +++ b/python/damask/_orientation.py @@ -481,26 +481,26 @@ class Orientation(Rotation): if self.family is None: raise ValueError('Missing crystal symmetry') - rho_abs = np.abs(self.as_Rodrigues_vector(compact=True)) + rho_abs = np.abs(self.as_Rodrigues_vector(compact=True))*(1.-1.e-9) with np.errstate(invalid='ignore'): # using '*'/prod for 'and' if self.family == 'cubic': return (np.prod(np.sqrt(2)-1. >= rho_abs,axis=-1) * - (1. >= np.sum(rho_abs,axis=-1))).astype(np.bool) + (1. >= np.sum(rho_abs,axis=-1))).astype(bool) elif self.family == 'hexagonal': return (np.prod(1. >= rho_abs,axis=-1) * (2. >= np.sqrt(3)*rho_abs[...,0] + rho_abs[...,1]) * (2. >= np.sqrt(3)*rho_abs[...,1] + rho_abs[...,0]) * - (2. >= np.sqrt(3) + rho_abs[...,2])).astype(np.bool) + (2. >= np.sqrt(3) + rho_abs[...,2])).astype(bool) elif self.family == 'tetragonal': return (np.prod(1. >= rho_abs[...,:2],axis=-1) * (np.sqrt(2) >= rho_abs[...,0] + rho_abs[...,1]) * - (np.sqrt(2) >= rho_abs[...,2] + 1.)).astype(np.bool) + (np.sqrt(2) >= rho_abs[...,2] + 1.)).astype(bool) elif self.family == 'orthorhombic': - return (np.prod(1. >= rho_abs,axis=-1)).astype(np.bool) + return (np.prod(1. >= rho_abs,axis=-1)).astype(bool) elif self.family == 'monoclinic': - return (1. >= rho_abs[...,1]).astype(np.bool) + return (1. >= rho_abs[...,1]).astype(bool) else: return np.all(np.isfinite(rho_abs),axis=-1) @@ -524,28 +524,28 @@ class Orientation(Rotation): if self.family is None: raise ValueError('Missing crystal symmetry') - rho = self.as_Rodrigues_vector(compact=True) + rho = self.as_Rodrigues_vector(compact=True)*(1.0-1.0e-9) with np.errstate(invalid='ignore'): if self.family == 'cubic': return ((rho[...,0] >= rho[...,1]) & (rho[...,1] >= rho[...,2]) & - (rho[...,2] >= 0)).astype(np.bool) + (rho[...,2] >= 0)).astype(bool) elif self.family == 'hexagonal': return ((rho[...,0] >= rho[...,1]*np.sqrt(3)) & (rho[...,1] >= 0) & - (rho[...,2] >= 0)).astype(np.bool) + (rho[...,2] >= 0)).astype(bool) elif self.family == 'tetragonal': return ((rho[...,0] >= rho[...,1]) & (rho[...,1] >= 0) & - (rho[...,2] >= 0)).astype(np.bool) + (rho[...,2] >= 0)).astype(bool) elif self.family == 'orthorhombic': return ((rho[...,0] >= 0) & (rho[...,1] >= 0) & - (rho[...,2] >= 0)).astype(np.bool) + (rho[...,2] >= 0)).astype(bool) elif self.family == 'monoclinic': return ((rho[...,1] >= 0) & - (rho[...,2] >= 0)).astype(np.bool) + (rho[...,2] >= 0)).astype(bool) else: return np.ones_like(rho[...,0],dtype=bool) diff --git a/python/tests/test_Orientation.py b/python/tests/test_Orientation.py index 436b73c04..4d1f958e2 100644 --- a/python/tests/test_Orientation.py +++ b/python/tests/test_Orientation.py @@ -7,6 +7,7 @@ from damask import Orientation from damask import Table from damask import lattice from damask import util +from damask import grid_filters @pytest.fixture @@ -220,6 +221,16 @@ class TestOrientation: o = Orientation.from_random(lattice=lattice,shape=shape) for r, theO in zip(o.reduced.flatten(),o.flatten()): assert r == theO.reduced + + @pytest.mark.parametrize('lattice',Orientation.crystal_families) + def test_reduced_corner_cases(self,lattice): + # test whether there is always a sym-eq rotation that falls into the FZ + N = np.random.randint(10,40) + size = np.ones(3)*np.pi**(2./3.) + grid = grid_filters.coordinates0_node([N+1,N+1,N+1],size,-size*.5) + evenly_distributed = Orientation.from_cubochoric(c=grid[:-2,:-2,:-2],lattice=lattice) + assert evenly_distributed.shape == evenly_distributed.reduced.shape + @pytest.mark.parametrize('lattice',Orientation.crystal_families) @pytest.mark.parametrize('shape',[(1),(2,3),(4,3,2)]) From 5b8e1996273572de5c36e8d1fcaec22ac89a6820 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Tue, 9 Feb 2021 23:09:41 +0100 Subject: [PATCH 11/60] avoid errors related to CRLF (windows) file endings --- src/IO.f90 | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/IO.f90 b/src/IO.f90 index fd87907aa..33ab7ee97 100644 --- a/src/IO.f90 +++ b/src/IO.f90 @@ -65,8 +65,8 @@ end subroutine IO_init function IO_readlines(fileName) result(fileContent) character(len=*), intent(in) :: fileName - character(len=pStringLen), dimension(:), allocatable :: fileContent !< file content, separated per lines + character(len=pStringLen) :: line character(len=:), allocatable :: rawData integer :: & @@ -75,6 +75,7 @@ function IO_readlines(fileName) result(fileContent) l logical :: warned + rawData = IO_read(fileName) !-------------------------------------------------------------------------------------------------- @@ -112,17 +113,20 @@ end function IO_readlines !-------------------------------------------------------------------------------------------------- !> @brief Read whole file. -!> @details ensures that the string ends with a new line (expected UNIX behavior) +!> @details ensures that the string ends with a new line (expected UNIX behavior) and rejects +! windows (CRLF) line endings !-------------------------------------------------------------------------------------------------- function IO_read(fileName) result(fileContent) character(len=*), intent(in) :: fileName character(len=:), allocatable :: fileContent + integer :: & fileLength, & fileUnit, & myStat + inquire(file = fileName, size=fileLength) open(newunit=fileUnit, file=fileName, access='stream',& status='old', position='rewind', action='read',iostat=myStat) @@ -137,6 +141,8 @@ function IO_read(fileName) result(fileContent) if(myStat /= 0) call IO_error(102,ext_msg=trim(fileName)) close(fileUnit) + if(scan(fileContent,achar(13)) /= 0) call IO_error(115) + if(fileContent(fileLength:fileLength) /= IO_EOL) fileContent = fileContent//IO_EOL ! ensure EOL@EOF end function IO_read @@ -151,6 +157,7 @@ logical pure function IO_isBlank(string) integer :: posNonBlank + posNonBlank = verify(string,IO_WHITESPACE) IO_isBlank = posNonBlank == 0 .or. posNonBlank == scan(string,IO_COMMENT) @@ -170,6 +177,7 @@ pure function IO_stringPos(string) integer :: left, right + allocate(IO_stringPos(1), source=0) right = 0 @@ -249,6 +257,7 @@ pure function IO_lc(string) integer :: i,n + do i=1,len(string) n = index(UPPER,string(i:i)) if(n/=0) then @@ -271,6 +280,7 @@ function IO_rmComment(line) character(len=:), allocatable :: IO_rmComment integer :: split + split = index(line,IO_COMMENT) if (split == 0) then @@ -292,6 +302,7 @@ integer function IO_stringAsInt(string) integer :: readStatus character(len=*), parameter :: VALIDCHARS = '0123456789+- ' + valid: if (verify(string,VALIDCHARS) == 0) then read(string,*,iostat=readStatus) IO_stringAsInt if (readStatus /= 0) call IO_error(111,ext_msg=string) @@ -313,6 +324,7 @@ real(pReal) function IO_stringAsFloat(string) integer :: readStatus character(len=*), parameter :: VALIDCHARS = '0123456789eE.+- ' + valid: if (verify(string,VALIDCHARS) == 0) then read(string,*,iostat=readStatus) IO_stringAsFloat if (readStatus /= 0) call IO_error(112,ext_msg=string) @@ -331,6 +343,7 @@ logical function IO_stringAsBool(string) character(len=*), intent(in) :: string !< string for conversion to int value + if (trim(adjustl(string)) == 'True' .or. trim(adjustl(string)) == 'true') then IO_stringAsBool = .true. elseif (trim(adjustl(string)) == 'False' .or. trim(adjustl(string)) == 'false') then @@ -356,6 +369,7 @@ subroutine IO_error(error_ID,el,ip,g,instance,ext_msg) character(len=:), allocatable :: msg character(len=pStringLen) :: formatString + select case (error_ID) !-------------------------------------------------------------------------------------------------- @@ -382,6 +396,9 @@ subroutine IO_error(error_ID,el,ip,g,instance,ext_msg) msg = 'invalid character for logical:' case (114) msg = 'cannot decode base64 string:' + case (115) + msg = 'found CR. Windows file endings (CRLF) are not supported.' + !-------------------------------------------------------------------------------------------------- ! lattice error messages From ef45e856a15cb1f265b08f5c8934a8fc28ad6489 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Wed, 10 Feb 2021 09:07:42 +0100 Subject: [PATCH 12/60] don't scan the whole file in case of proper line endings might lead to strange behavior if people randomly distribute CRs in their file. But that actually deserves to get strange behavior + Test --- PRIVATE | 2 +- src/IO.f90 | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/PRIVATE b/PRIVATE index d90babadf..5d27d879a 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit d90babadfb0a33afa1b793044cc4efd4d7430731 +Subproject commit 5d27d879abaeb1542e3f9f3065172be740af2899 diff --git a/src/IO.f90 b/src/IO.f90 index 33ab7ee97..36b774191 100644 --- a/src/IO.f90 +++ b/src/IO.f90 @@ -124,7 +124,9 @@ function IO_read(fileName) result(fileContent) integer :: & fileLength, & fileUnit, & - myStat + myStat, & + firstEOL + character, parameter :: CR = achar(13) inquire(file = fileName, size=fileLength) @@ -141,10 +143,12 @@ function IO_read(fileName) result(fileContent) if(myStat /= 0) call IO_error(102,ext_msg=trim(fileName)) close(fileUnit) - if(scan(fileContent,achar(13)) /= 0) call IO_error(115) if(fileContent(fileLength:fileLength) /= IO_EOL) fileContent = fileContent//IO_EOL ! ensure EOL@EOF + firstEOL = index(fileContent,IO_EOL) + if(scan(fileContent(firstEOL:firstEOL),CR) /= 0) call IO_error(115) + end function IO_read From 6895ef6b18b2cc3b3c26d0ab09c81e0115016b21 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Wed, 10 Feb 2021 10:03:35 +0100 Subject: [PATCH 13/60] always write LF line endings small pitfall: I windows users use a filehandle that results from a call to open() without the newline option, they get still CRLF line endings --- python/damask/_colormap.py | 16 ++++++++-------- python/damask/_config.py | 2 +- python/damask/_result.py | 2 +- python/damask/_table.py | 2 +- python/damask/solver/_marc.py | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/python/damask/_colormap.py b/python/damask/_colormap.py index 5a22f049b..8af14e081 100644 --- a/python/damask/_colormap.py +++ b/python/damask/_colormap.py @@ -238,7 +238,7 @@ class Colormap(mpl.colors.ListedColormap): fhandle = None else: try: - fhandle = open(fname,'w') + fhandle = open(fname,'w',newline='\n') except TypeError: fhandle = fname @@ -254,7 +254,7 @@ class Colormap(mpl.colors.ListedColormap): 'RGBPoints':colors }] - with open(self.name.replace(' ','_')+'.json', 'w') if fhandle is None else fhandle as f: + with open(self.name.replace(' ','_')+'.json','w',newline='\n') if fhandle is None else fhandle as f: json.dump(out, f,indent=4) @@ -273,14 +273,14 @@ class Colormap(mpl.colors.ListedColormap): fhandle = None else: try: - fhandle = open(fname,'w') + fhandle = open(fname,'w',newline='\n') except TypeError: fhandle = fname labels = {'RGBA':4} if self.colors.shape[1] == 4 else {'RGB': 3} t = Table(self.colors,labels,f'Creator: {util.execution_stamp("Colormap")}') - with open(self.name.replace(' ','_')+'.txt', 'w') if fhandle is None else fhandle as f: + with open(self.name.replace(' ','_')+'.txt','w',newline='\n') if fhandle is None else fhandle as f: t.save(f) @@ -299,7 +299,7 @@ class Colormap(mpl.colors.ListedColormap): fhandle = None else: try: - fhandle = open(fname,'w') + fhandle = open(fname,'w',newline='\n') except TypeError: fhandle = fname # ToDo: test in GOM @@ -308,7 +308,7 @@ class Colormap(mpl.colors.ListedColormap): + f'30 NO_UNIT 1 1 64 64 64 255 1 0 0 0 0 0 0 3 0 {len(self.colors)}' \ + ' '.join([f' 0 {c[0]} {c[1]} {c[2]} 255 1' for c in reversed((self.colors*255).astype(int))]) \ + '\n' - with open(self.name.replace(' ','_')+'.legend', 'w') if fhandle is None else fhandle as f: + with open(self.name.replace(' ','_')+'.legend','w',newline='\n') if fhandle is None else fhandle as f: f.write(GOM_str) @@ -327,14 +327,14 @@ class Colormap(mpl.colors.ListedColormap): fhandle = None else: try: - fhandle = open(fname,'w') + fhandle = open(fname,'w',newline='\n') except TypeError: fhandle = fname # ToDo: test in gmsh gmsh_str = 'View.ColorTable = {\n' \ +'\n'.join([f'{c[0]},{c[1]},{c[2]},' for c in self.colors[:,:3]*255]) \ +'\n}\n' - with open(self.name.replace(' ','_')+'.msh', 'w') if fhandle is None else fhandle as f: + with open(self.name.replace(' ','_')+'.msh','w',newline='\n') if fhandle is None else fhandle as f: f.write(gmsh_str) diff --git a/python/damask/_config.py b/python/damask/_config.py index 9aa031ff0..edf3a5676 100644 --- a/python/damask/_config.py +++ b/python/damask/_config.py @@ -75,7 +75,7 @@ class Config(dict): """ try: - fhandle = open(fname,'w') + fhandle = open(fname,'w',newline='\n') except TypeError: fhandle = fname diff --git a/python/damask/_result.py b/python/damask/_result.py index 3d8368911..6f2494299 100644 --- a/python/damask/_result.py +++ b/python/damask/_result.py @@ -1287,7 +1287,7 @@ class Result: np.prod(shape))} data_items[-1].text=f'{os.path.split(self.fname)[1]}:{name}' - with open(self.fname.with_suffix('.xdmf').name,'w') as f: + with open(self.fname.with_suffix('.xdmf').name,'w',newline='\n') as f: f.write(xml.dom.minidom.parseString(ET.tostring(xdmf).decode()).toprettyxml()) diff --git a/python/damask/_table.py b/python/damask/_table.py index 78a8a276e..e9acb371d 100644 --- a/python/damask/_table.py +++ b/python/damask/_table.py @@ -380,7 +380,7 @@ class Table: [f'# {comment}' for comment in self.comments] try: - fhandle = open(fname,'w') + fhandle = open(fname,'w',newline='\n') except TypeError: fhandle = fname diff --git a/python/damask/solver/_marc.py b/python/damask/solver/_marc.py index d4aadb7ff..f6c81da9f 100644 --- a/python/damask/solver/_marc.py +++ b/python/damask/solver/_marc.py @@ -66,7 +66,7 @@ class Marc: if logfile is not None: try: - f = open(logfile,'w+') + f = open(logfile,'w+',newline='\n') except TypeError: f = logfile else: From 4e31862f0ff9cae6c89687bdad26ff660dd216d4 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Wed, 10 Feb 2021 18:35:13 +0100 Subject: [PATCH 14/60] avoid repetition --- python/damask/_colormap.py | 75 ++++++++++++++++++-------------------- python/damask/_table.py | 2 +- 2 files changed, 36 insertions(+), 41 deletions(-) diff --git a/python/damask/_colormap.py b/python/damask/_colormap.py index 8af14e081..7e8860dae 100644 --- a/python/damask/_colormap.py +++ b/python/damask/_colormap.py @@ -223,25 +223,46 @@ class Colormap(mpl.colors.ListedColormap): return Colormap(np.array(rev.colors),rev.name[:-4] if rev.name.endswith('_r_r') else rev.name) - def save_paraview(self,fname=None): + def _get_file_handle(self,fname,extension): """ - Save as JSON file for use in Paraview. + Provide file handle. Parameters ---------- - fname : file, str, or pathlib.Path, optional. - Filename to store results. If not given, the filename will - consist of the name of the colormap and extension '.json'. + fname : file, str, pathlib.Path, or None + Filename or filehandle, will be name of the colormap+extension if None. + + extension: str + Extension of the filename. + + Returns + ------- + f + File handle """ if fname is None: - fhandle = None + fhandle = open(self.name.replace(' ','_')+'.'+extension,'w',newline='\n') else: try: fhandle = open(fname,'w',newline='\n') except TypeError: fhandle = fname + return fhandle + + + def save_paraview(self,fname=None): + """ + Save as JSON file for use in Paraview. + + Parameters + ---------- + fname : file, str, or pathlib.Path, optional + Filename to store results. If not given, the filename will + consist of the name of the colormap and extension '.json'. + + """ colors = [] for i,c in enumerate(np.round(self.colors,6).tolist()): colors+=[i]+c @@ -254,8 +275,7 @@ class Colormap(mpl.colors.ListedColormap): 'RGBPoints':colors }] - with open(self.name.replace(' ','_')+'.json','w',newline='\n') if fhandle is None else fhandle as f: - json.dump(out, f,indent=4) + json.dump(out,self._get_file_handle(fname,'json'),indent=4) def save_ASCII(self,fname=None): @@ -264,24 +284,14 @@ class Colormap(mpl.colors.ListedColormap): Parameters ---------- - fname : file, str, or pathlib.Path, optional. + fname : file, str, or pathlib.Path, optional Filename to store results. If not given, the filename will consist of the name of the colormap and extension '.txt'. """ - if fname is None: - fhandle = None - else: - try: - fhandle = open(fname,'w',newline='\n') - except TypeError: - fhandle = fname - labels = {'RGBA':4} if self.colors.shape[1] == 4 else {'RGB': 3} t = Table(self.colors,labels,f'Creator: {util.execution_stamp("Colormap")}') - - with open(self.name.replace(' ','_')+'.txt','w',newline='\n') if fhandle is None else fhandle as f: - t.save(f) + t.save(self._get_file_handle(fname,'txt')) def save_GOM(self,fname=None): @@ -290,26 +300,19 @@ class Colormap(mpl.colors.ListedColormap): Parameters ---------- - fname : file, str, or pathlib.Path, optional. + fname : file, str, or pathlib.Path, optional Filename to store results. If not given, the filename will consist of the name of the colormap and extension '.legend'. """ - if fname is None: - fhandle = None - else: - try: - fhandle = open(fname,'w',newline='\n') - except TypeError: - fhandle = fname # ToDo: test in GOM GOM_str = '1 1 {name} 9 {name} '.format(name=self.name.replace(" ","_")) \ + '0 1 0 3 0 0 -1 9 \\ 0 0 0 255 255 255 0 0 255 ' \ + f'30 NO_UNIT 1 1 64 64 64 255 1 0 0 0 0 0 0 3 0 {len(self.colors)}' \ + ' '.join([f' 0 {c[0]} {c[1]} {c[2]} 255 1' for c in reversed((self.colors*255).astype(int))]) \ + '\n' - with open(self.name.replace(' ','_')+'.legend','w',newline='\n') if fhandle is None else fhandle as f: - f.write(GOM_str) + + self._get_file_handle(fname,'legend').write(GOM_str) def save_gmsh(self,fname=None): @@ -318,24 +321,16 @@ class Colormap(mpl.colors.ListedColormap): Parameters ---------- - fname : file, str, or pathlib.Path, optional. + fname : file, str, or pathlib.Path, optional Filename to store results. If not given, the filename will consist of the name of the colormap and extension '.msh'. """ - if fname is None: - fhandle = None - else: - try: - fhandle = open(fname,'w',newline='\n') - except TypeError: - fhandle = fname # ToDo: test in gmsh gmsh_str = 'View.ColorTable = {\n' \ +'\n'.join([f'{c[0]},{c[1]},{c[2]},' for c in self.colors[:,:3]*255]) \ +'\n}\n' - with open(self.name.replace(' ','_')+'.msh','w',newline='\n') if fhandle is None else fhandle as f: - f.write(gmsh_str) + self._get_file_handle(fname,'msh').write(gmsh_str) @staticmethod diff --git a/python/damask/_table.py b/python/damask/_table.py index e9acb371d..68d6f94bf 100644 --- a/python/damask/_table.py +++ b/python/damask/_table.py @@ -26,7 +26,7 @@ class Table: comments_ = [comments] if isinstance(comments,str) else comments self.comments = [] if comments_ is None else [c for c in comments_] self.data = pd.DataFrame(data=data) - self.shapes = { k:(v,) if isinstance(v,(np.int,int)) else v for k,v in shapes.items() } + self.shapes = { k:(v,) if isinstance(v,(np.int64,np.int32,int)) else v for k,v in shapes.items() } self._label_uniform() def __repr__(self): From 992b4a7e6dab945b6d5dc3bb848e7ab310ffa0ab Mon Sep 17 00:00:00 2001 From: Test User Date: Thu, 11 Feb 2021 11:42:33 +0100 Subject: [PATCH 15/60] [skip ci] updated version information after successful test of v3.0.0-alpha2-421-ge96352b0e --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index b91ec55e4..a1f129287 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v3.0.0-alpha2-415-g09c2d7f3f +v3.0.0-alpha2-421-ge96352b0e From e855083964794f44aa0793597c945091b5b34ff2 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Mon, 8 Feb 2021 23:21:53 +0100 Subject: [PATCH 16/60] systematic names --- src/CPFEM.f90 | 6 +- src/CPFEM2.f90 | 10 +- src/commercialFEM_fileList.f90 | 34 +- src/grid/DAMASK_grid.f90 | 66 +-- src/grid/grid_mech_FEM.f90 | 135 +++--- src/grid/grid_mech_spectral_basic.f90 | 40 +- src/grid/grid_mech_spectral_polarisation.f90 | 40 +- src/homogenization.f90 | 32 +- src/homogenization_damage.f90 | 4 +- ...nics.f90 => homogenization_mechanical.f90} | 94 ++--- ....f90 => homogenization_mechanical_RGC.f90} | 24 +- ...> homogenization_mechanical_isostrain.f90} | 14 +- ...f90 => homogenization_mechanical_pass.f90} | 8 +- src/homogenization_thermal.f90 | 6 +- src/mesh/DAMASK_mesh.f90 | 8 +- src/mesh/FEM_utilities.f90 | 12 +- src/mesh/mesh_mech_FEM.f90 | 110 ++--- src/phase.f90 | 180 ++++---- src/phase_damage.f90 | 34 +- src/phase_damage_anisobrittle.f90 | 2 +- src/phase_damage_anisoductile.f90 | 2 +- src/phase_damage_isobrittle.f90 | 2 +- src/phase_damage_isoductile.f90 | 2 +- ...ase_mechanics.f90 => phase_mechanical.f90} | 384 +++++++++--------- ...rmation.f90 => phase_mechanical_eigen.f90} | 14 +- ...hase_mechanical_eigen_cleavageopening.f90} | 0 ...ase_mechanical_eigen_slipplaneopening.f90} | 0 ...ase_mechanical_eigen_thermalexpansion.f90} | 0 ...astic.f90 => phase_mechanical_plastic.f90} | 64 +-- ...hase_mechanical_plastic_dislotungsten.f90} | 16 +- ...=> phase_mechanical_plastic_dislotwin.f90} | 36 +- ...=> phase_mechanical_plastic_isotropic.f90} | 8 +- ...hase_mechanical_plastic_kinehardening.f90} | 16 +- ....f90 => phase_mechanical_plastic_none.f90} | 2 +- ... => phase_mechanical_plastic_nonlocal.f90} | 64 +-- ...hase_mechanical_plastic_phenopowerlaw.f90} | 22 +- src/phase_thermal.f90 | 14 +- src/phase_thermal_dissipation.f90 | 4 +- src/phase_thermal_externalheat.f90 | 2 +- 39 files changed, 769 insertions(+), 742 deletions(-) rename src/{homogenization_mechanics.f90 => homogenization_mechanical.f90} (79%) rename src/{homogenization_mechanics_RGC.f90 => homogenization_mechanical_RGC.f90} (98%) rename src/{homogenization_mechanics_isostrain.f90 => homogenization_mechanical_isostrain.f90} (91%) rename src/{homogenization_mechanics_none.f90 => homogenization_mechanical_pass.f90} (87%) rename src/{phase_mechanics.f90 => phase_mechanical.f90} (82%) rename src/{phase_mechanics_eigendeformation.f90 => phase_mechanical_eigen.f90} (96%) rename src/{phase_mechanics_eigendeformation_cleavageopening.f90 => phase_mechanical_eigen_cleavageopening.f90} (100%) rename src/{phase_mechanics_eigendeformation_slipplaneopening.f90 => phase_mechanical_eigen_slipplaneopening.f90} (100%) rename src/{phase_mechanics_eigendeformation_thermalexpansion.f90 => phase_mechanical_eigen_thermalexpansion.f90} (100%) rename src/{phase_mechanics_plastic.f90 => phase_mechanical_plastic.f90} (91%) rename src/{phase_mechanics_plastic_dislotungsten.f90 => phase_mechanical_plastic_dislotungsten.f90} (97%) rename src/{phase_mechanics_plastic_dislotwin.f90 => phase_mechanical_plastic_dislotwin.f90} (97%) rename src/{phase_mechanics_plastic_isotropic.f90 => phase_mechanical_plastic_isotropic.f90} (97%) rename src/{phase_mechanics_plastic_kinehardening.f90 => phase_mechanical_plastic_kinehardening.f90} (97%) rename src/{phase_mechanics_plastic_none.f90 => phase_mechanical_plastic_none.f90} (96%) rename src/{phase_mechanics_plastic_nonlocal.f90 => phase_mechanical_plastic_nonlocal.f90} (97%) rename src/{phase_mechanics_plastic_phenopowerlaw.f90 => phase_mechanical_plastic_phenopowerlaw.f90} (96%) diff --git a/src/CPFEM.f90 b/src/CPFEM.f90 index e441339cb..f0e510433 100644 --- a/src/CPFEM.f90 +++ b/src/CPFEM.f90 @@ -85,7 +85,7 @@ subroutine CPFEM_initAll call discretization_marc_init call lattice_init call material_init(.false.) - call constitutive_init + call phase_init call homogenization_init call crystallite_init call CPFEM_init @@ -257,7 +257,7 @@ end subroutine CPFEM_general subroutine CPFEM_forward call homogenization_forward - call constitutive_forward + call phase_forward end subroutine CPFEM_forward @@ -272,7 +272,7 @@ subroutine CPFEM_results(inc,time) call results_openJobFile call results_addIncrement(inc,time) - call constitutive_results + call phase_results call homogenization_results call discretization_results call results_finalizeIncrement diff --git a/src/CPFEM2.f90 b/src/CPFEM2.f90 index 2b32a0cbb..e57de7f67 100644 --- a/src/CPFEM2.f90 +++ b/src/CPFEM2.f90 @@ -60,7 +60,7 @@ subroutine CPFEM_initAll call discretization_grid_init(restart=interface_restartInc>0) #endif call material_init(restart=interface_restartInc>0) - call constitutive_init + call phase_init call homogenization_init call crystallite_init call CPFEM_init @@ -87,7 +87,7 @@ subroutine CPFEM_init fileHandle = HDF5_openFile(fileName) call homogenization_restartRead(fileHandle) - call constitutive_restartRead(fileHandle) + call phase_restartRead(fileHandle) call HDF5_closeFile(fileHandle) endif @@ -110,7 +110,7 @@ subroutine CPFEM_restartWrite fileHandle = HDF5_openFile(fileName,'a') call homogenization_restartWrite(fileHandle) - call constitutive_restartWrite(fileHandle) + call phase_restartWrite(fileHandle) call HDF5_closeFile(fileHandle) @@ -123,7 +123,7 @@ end subroutine CPFEM_restartWrite subroutine CPFEM_forward call homogenization_forward - call constitutive_forward + call phase_forward end subroutine CPFEM_forward @@ -138,7 +138,7 @@ subroutine CPFEM_results(inc,time) call results_openJobFile call results_addIncrement(inc,time) - call constitutive_results + call phase_results call homogenization_results call discretization_results call results_finalizeIncrement diff --git a/src/commercialFEM_fileList.f90 b/src/commercialFEM_fileList.f90 index 6480f7382..a191298a3 100644 --- a/src/commercialFEM_fileList.f90 +++ b/src/commercialFEM_fileList.f90 @@ -20,19 +20,19 @@ #include "material.f90" #include "lattice.f90" #include "phase.f90" -#include "phase_mechanics.f90" -#include "phase_mechanics_plastic.f90" -#include "phase_mechanics_plastic_none.f90" -#include "phase_mechanics_plastic_isotropic.f90" -#include "phase_mechanics_plastic_phenopowerlaw.f90" -#include "phase_mechanics_plastic_kinehardening.f90" -#include "phase_mechanics_plastic_dislotwin.f90" -#include "phase_mechanics_plastic_dislotungsten.f90" -#include "phase_mechanics_plastic_nonlocal.f90" -#include "phase_mechanics_eigendeformation.f90" -#include "phase_mechanics_eigendeformation_cleavageopening.f90" -#include "phase_mechanics_eigendeformation_slipplaneopening.f90" -#include "phase_mechanics_eigendeformation_thermalexpansion.f90" +#include "phase_mechanical.f90" +#include "phase_mechanical_plastic.f90" +#include "phase_mechanical_plastic_none.f90" +#include "phase_mechanical_plastic_isotropic.f90" +#include "phase_mechanical_plastic_phenopowerlaw.f90" +#include "phase_mechanical_plastic_kinehardening.f90" +#include "phase_mechanical_plastic_dislotwin.f90" +#include "phase_mechanical_plastic_dislotungsten.f90" +#include "phase_mechanical_plastic_nonlocal.f90" +#include "phase_mechanical_eigen.f90" +#include "phase_mechanical_eigen_cleavageopening.f90" +#include "phase_mechanical_eigen_slipplaneopening.f90" +#include "phase_mechanical_eigen_thermalexpansion.f90" #include "phase_thermal.f90" #include "phase_thermal_dissipation.f90" #include "phase_thermal_externalheat.f90" @@ -44,10 +44,10 @@ #include "damage_none.f90" #include "damage_nonlocal.f90" #include "homogenization.f90" -#include "homogenization_mechanics.f90" -#include "homogenization_mechanics_none.f90" -#include "homogenization_mechanics_isostrain.f90" -#include "homogenization_mechanics_RGC.f90" +#include "homogenization_mechanical.f90" +#include "homogenization_mechanical_pass.f90" +#include "homogenization_mechanical_isostrain.f90" +#include "homogenization_mechanical_RGC.f90" #include "homogenization_thermal.f90" #include "homogenization_damage.f90" #include "CPFEM.f90" diff --git a/src/grid/DAMASK_grid.f90 b/src/grid/DAMASK_grid.f90 index 7e649ff38..ed1ada171 100644 --- a/src/grid/DAMASK_grid.f90 +++ b/src/grid/DAMASK_grid.f90 @@ -18,9 +18,9 @@ program DAMASK_grid use CPFEM2 use material use spectral_utilities - use grid_mech_spectral_basic - use grid_mech_spectral_polarisation - use grid_mech_FEM + use grid_mechanical_spectral_basic + use grid_mechanical_spectral_polarisation + use grid_mechanical_FEM use grid_damage_spectral use grid_thermal_spectral use results @@ -83,16 +83,16 @@ program DAMASK_grid type(tLoadCase), allocatable, dimension(:) :: loadCases !< array of all load cases type(tSolutionState), allocatable, dimension(:) :: solres - procedure(grid_mech_spectral_basic_init), pointer :: & - mech_init - procedure(grid_mech_spectral_basic_forward), pointer :: & - mech_forward - procedure(grid_mech_spectral_basic_solution), pointer :: & - mech_solution - procedure(grid_mech_spectral_basic_updateCoords), pointer :: & - mech_updateCoords - procedure(grid_mech_spectral_basic_restartWrite), pointer :: & - mech_restartWrite + procedure(grid_mechanical_spectral_basic_init), pointer :: & + mechanical_init + procedure(grid_mechanical_spectral_basic_forward), pointer :: & + mechanical_forward + procedure(grid_mechanical_spectral_basic_solution), pointer :: & + mechanical_solution + procedure(grid_mechanical_spectral_basic_updateCoords), pointer :: & + mechanical_updateCoords + procedure(grid_mechanical_spectral_basic_restartWrite), pointer :: & + mechanical_restartWrite external :: & quit @@ -139,25 +139,25 @@ program DAMASK_grid debug_grid => config_debug%get('grid',defaultVal=emptyList) select case (trim(num_grid%get_asString('solver', defaultVal = 'Basic'))) case ('Basic') - mech_init => grid_mech_spectral_basic_init - mech_forward => grid_mech_spectral_basic_forward - mech_solution => grid_mech_spectral_basic_solution - mech_updateCoords => grid_mech_spectral_basic_updateCoords - mech_restartWrite => grid_mech_spectral_basic_restartWrite + mechanical_init => grid_mechanical_spectral_basic_init + mechanical_forward => grid_mechanical_spectral_basic_forward + mechanical_solution => grid_mechanical_spectral_basic_solution + mechanical_updateCoords => grid_mechanical_spectral_basic_updateCoords + mechanical_restartWrite => grid_mechanical_spectral_basic_restartWrite case ('Polarisation') - mech_init => grid_mech_spectral_polarisation_init - mech_forward => grid_mech_spectral_polarisation_forward - mech_solution => grid_mech_spectral_polarisation_solution - mech_updateCoords => grid_mech_spectral_polarisation_updateCoords - mech_restartWrite => grid_mech_spectral_polarisation_restartWrite + mechanical_init => grid_mechanical_spectral_polarisation_init + mechanical_forward => grid_mechanical_spectral_polarisation_forward + mechanical_solution => grid_mechanical_spectral_polarisation_solution + mechanical_updateCoords => grid_mechanical_spectral_polarisation_updateCoords + mechanical_restartWrite => grid_mechanical_spectral_polarisation_restartWrite case ('FEM') - mech_init => grid_mech_FEM_init - mech_forward => grid_mech_FEM_forward - mech_solution => grid_mech_FEM_solution - mech_updateCoords => grid_mech_FEM_updateCoords - mech_restartWrite => grid_mech_FEM_restartWrite + mechanical_init => grid_mechanical_FEM_init + mechanical_forward => grid_mechanical_FEM_forward + mechanical_solution => grid_mechanical_FEM_solution + mechanical_updateCoords => grid_mechanical_FEM_updateCoords + mechanical_restartWrite => grid_mechanical_FEM_restartWrite case default call IO_error(error_ID = 891, ext_msg = trim(num_grid%get_asString('solver'))) @@ -303,7 +303,7 @@ program DAMASK_grid do field = 1, nActiveFields select case (loadCases(1)%ID(field)) case(FIELD_MECH_ID) - call mech_init + call mechanical_init case(FIELD_THERMAL_ID) call grid_thermal_spectral_init @@ -379,7 +379,7 @@ program DAMASK_grid do field = 1, nActiveFields select case(loadCases(l)%ID(field)) case(FIELD_MECH_ID) - call mech_forward (& + call mechanical_forward (& cutBack,guess,timeinc,timeIncOld,remainingLoadCaseTime, & deformation_BC = loadCases(l)%deformation, & stress_BC = loadCases(l)%stress, & @@ -399,7 +399,7 @@ program DAMASK_grid do field = 1, nActiveFields select case(loadCases(l)%ID(field)) case(FIELD_MECH_ID) - solres(field) = mech_solution(incInfo) + solres(field) = mechanical_solution(incInfo) case(FIELD_THERMAL_ID) solres(field) = grid_thermal_spectral_solution(timeinc) case(FIELD_DAMAGE_ID) @@ -420,7 +420,7 @@ program DAMASK_grid if ( (all(solres(:)%converged .and. solres(:)%stagConverged)) & ! converged .and. .not. solres(1)%termIll) then ! and acceptable solution found - call mech_updateCoords + call mechanical_updateCoords timeIncOld = timeinc cutBack = .false. guess = .true. ! start guessing after first converged (sub)inc @@ -463,7 +463,7 @@ program DAMASK_grid call MPI_Allreduce(interface_SIGUSR2,signal,1,MPI_LOGICAL,MPI_LOR,PETSC_COMM_WORLD,ierr) if (ierr /= 0) error stop 'MPI error' if (mod(inc,loadCases(l)%f_restart) == 0 .or. signal) then - call mech_restartWrite + call mechanical_restartWrite call CPFEM_restartWrite endif if(signal) call interface_setSIGUSR2(.false.) diff --git a/src/grid/grid_mech_FEM.f90 b/src/grid/grid_mech_FEM.f90 index 003f568c6..806973a4d 100644 --- a/src/grid/grid_mech_FEM.f90 +++ b/src/grid/grid_mech_FEM.f90 @@ -4,7 +4,7 @@ !> @author Pratheek Shanthraj, Max-Planck-Institut für Eisenforschung GmbH !> @brief Grid solver for mechanics: FEM !-------------------------------------------------------------------------------------------------- -module grid_mech_FEM +module grid_mechanical_FEM #include #include use PETScdmda @@ -45,8 +45,8 @@ module grid_mech_FEM !-------------------------------------------------------------------------------------------------- ! PETSc data - DM :: mech_grid - SNES :: mech_snes + DM :: mechanical_grid + SNES :: mechanical_snes Vec :: solution_current, solution_lastInc, solution_rate !-------------------------------------------------------------------------------------------------- @@ -79,18 +79,18 @@ module grid_mech_FEM totalIter = 0 !< total iteration in current increment public :: & - grid_mech_FEM_init, & - grid_mech_FEM_solution, & - grid_mech_FEM_forward, & - grid_mech_FEM_updateCoords, & - grid_mech_FEM_restartWrite + grid_mechanical_FEM_init, & + grid_mechanical_FEM_solution, & + grid_mechanical_FEM_forward, & + grid_mechanical_FEM_updateCoords, & + grid_mechanical_FEM_restartWrite contains !-------------------------------------------------------------------------------------------------- !> @brief allocates all necessary fields and fills them with data, potentially from restart info !-------------------------------------------------------------------------------------------------- -subroutine grid_mech_FEM_init +subroutine grid_mechanical_FEM_init real(pReal), parameter :: HGCoeff = 0.0e-2_pReal real(pReal), parameter, dimension(4,8) :: & @@ -114,7 +114,7 @@ subroutine grid_mech_FEM_init num_grid, & debug_grid - print'(/,a)', ' <<<+- grid_mech_FEM init -+>>>'; flush(IO_STDOUT) + print'(/,a)', ' <<<+- grid_mechanical_FEM init -+>>>'; flush(IO_STDOUT) !------------------------------------------------------------------------------------------------- ! debugging options @@ -141,8 +141,11 @@ subroutine grid_mech_FEM_init !-------------------------------------------------------------------------------------------------- ! set default and user defined options for PETSc - call PetscOptionsInsertString(PETSC_NULL_OPTIONS,'-mech_snes_type newtonls -mech_ksp_type fgmres & - &-mech_ksp_max_it 25 -mech_pc_type ml -mech_mg_levels_ksp_type chebyshev',ierr) + call PetscOptionsInsertString(PETSC_NULL_OPTIONS, & + '-mechanical_snes_type newtonls -mechanical_ksp_type fgmres & + &-mechanical_ksp_max_it 25 -mechanical_pc_type ml & + &-mechanical_mg_levels_ksp_type chebyshev', & + ierr) CHKERRQ(ierr) call PetscOptionsInsertString(PETSC_NULL_OPTIONS,num_grid%get_asString('petsc_options',defaultVal=''),ierr) CHKERRQ(ierr) @@ -155,8 +158,10 @@ subroutine grid_mech_FEM_init !-------------------------------------------------------------------------------------------------- ! initialize solver specific parts of PETSc - call SNESCreate(PETSC_COMM_WORLD,mech_snes,ierr); CHKERRQ(ierr) - call SNESSetOptionsPrefix(mech_snes,'mech_',ierr);CHKERRQ(ierr) + call SNESCreate(PETSC_COMM_WORLD,mechanical_snes,ierr) + CHKERRQ(ierr) + call SNESSetOptionsPrefix(mechanical_snes,'mechanical_',ierr) + CHKERRQ(ierr) localK = 0 localK(worldrank) = grid3 call MPI_Allreduce(MPI_IN_PLACE,localK,worldsize,MPI_INTEGER,MPI_SUM,PETSC_COMM_WORLD,ierr) @@ -167,34 +172,44 @@ subroutine grid_mech_FEM_init 1, 1, worldsize, & 3, 1, & [grid(1)],[grid(2)],localK, & - mech_grid,ierr) + mechanical_grid,ierr) CHKERRQ(ierr) - call SNESSetDM(mech_snes,mech_grid,ierr); CHKERRQ(ierr) - call DMsetFromOptions(mech_grid,ierr); CHKERRQ(ierr) - call DMsetUp(mech_grid,ierr); CHKERRQ(ierr) - call DMDASetUniformCoordinates(mech_grid,0.0_pReal,geomSize(1),0.0_pReal,geomSize(2),0.0_pReal,geomSize(3),ierr) + call SNESSetDM(mechanical_snes,mechanical_grid,ierr) CHKERRQ(ierr) - call DMCreateGlobalVector(mech_grid,solution_current,ierr); CHKERRQ(ierr) - call DMCreateGlobalVector(mech_grid,solution_lastInc,ierr); CHKERRQ(ierr) - call DMCreateGlobalVector(mech_grid,solution_rate ,ierr); CHKERRQ(ierr) - call DMSNESSetFunctionLocal(mech_grid,formResidual,PETSC_NULL_SNES,ierr) + call DMsetFromOptions(mechanical_grid,ierr) CHKERRQ(ierr) - call DMSNESSetJacobianLocal(mech_grid,formJacobian,PETSC_NULL_SNES,ierr) + call DMsetUp(mechanical_grid,ierr) CHKERRQ(ierr) - call SNESSetConvergenceTest(mech_snes,converged,PETSC_NULL_SNES,PETSC_NULL_FUNCTION,ierr) ! specify custom convergence check function "_converged" + call DMDASetUniformCoordinates(mechanical_grid,0.0_pReal,geomSize(1),0.0_pReal,geomSize(2),0.0_pReal,geomSize(3),ierr) + CHKERRQ(ierr) + call DMCreateGlobalVector(mechanical_grid,solution_current,ierr) + CHKERRQ(ierr) + call DMCreateGlobalVector(mechanical_grid,solution_lastInc,ierr) + CHKERRQ(ierr) + call DMCreateGlobalVector(mechanical_grid,solution_rate ,ierr) + CHKERRQ(ierr) + call DMSNESSetFunctionLocal(mechanical_grid,formResidual,PETSC_NULL_SNES,ierr) + CHKERRQ(ierr) + call DMSNESSetJacobianLocal(mechanical_grid,formJacobian,PETSC_NULL_SNES,ierr) + CHKERRQ(ierr) + call SNESSetConvergenceTest(mechanical_snes,converged,PETSC_NULL_SNES,PETSC_NULL_FUNCTION,ierr) ! specify custom convergence check function "_converged" + CHKERRQ(ierr) + call SNESSetMaxLinearSolveFailures(mechanical_snes, huge(1), ierr) ! ignore linear solve failures + CHKERRQ(ierr) + call SNESSetFromOptions(mechanical_snes,ierr) ! pull it all together with additional cli arguments CHKERRQ(ierr) - call SNESSetMaxLinearSolveFailures(mech_snes, huge(1), ierr); CHKERRQ(ierr) ! ignore linear solve failures - call SNESSetFromOptions(mech_snes,ierr); CHKERRQ(ierr) ! pull it all together with additional cli arguments !-------------------------------------------------------------------------------------------------- ! init fields call VecSet(solution_current,0.0_pReal,ierr);CHKERRQ(ierr) call VecSet(solution_lastInc,0.0_pReal,ierr);CHKERRQ(ierr) call VecSet(solution_rate ,0.0_pReal,ierr);CHKERRQ(ierr) - call DMDAVecGetArrayF90(mech_grid,solution_current,u_current,ierr); CHKERRQ(ierr) - call DMDAVecGetArrayF90(mech_grid,solution_lastInc,u_lastInc,ierr); CHKERRQ(ierr) + call DMDAVecGetArrayF90(mechanical_grid,solution_current,u_current,ierr) + CHKERRQ(ierr) + call DMDAVecGetArrayF90(mechanical_grid,solution_lastInc,u_lastInc,ierr) + CHKERRQ(ierr) - call DMDAGetCorners(mech_grid,xstart,ystart,zstart,xend,yend,zend,ierr) ! local grid extent + call DMDAGetCorners(mechanical_grid,xstart,ystart,zstart,xend,yend,zend,ierr) ! local grid extent CHKERRQ(ierr) xend = xstart+xend-1 yend = ystart+yend-1 @@ -242,9 +257,9 @@ subroutine grid_mech_FEM_init call utilities_constitutiveResponse(P_current,P_av,C_volAvg,devNull, & ! stress field, stress avg, global average of stiffness and (min+max)/2 F, & ! target F 0.0_pReal) ! time increment - call DMDAVecRestoreArrayF90(mech_grid,solution_current,u_current,ierr) + call DMDAVecRestoreArrayF90(mechanical_grid,solution_current,u_current,ierr) CHKERRQ(ierr) - call DMDAVecRestoreArrayF90(mech_grid,solution_lastInc,u_lastInc,ierr) + call DMDAVecRestoreArrayF90(mechanical_grid,solution_lastInc,u_lastInc,ierr) CHKERRQ(ierr) restartRead2: if (interface_restartInc > 0) then @@ -257,13 +272,13 @@ subroutine grid_mech_FEM_init endif restartRead2 -end subroutine grid_mech_FEM_init +end subroutine grid_mechanical_FEM_init !-------------------------------------------------------------------------------------------------- !> @brief solution for the FEM scheme with internal iterations !-------------------------------------------------------------------------------------------------- -function grid_mech_FEM_solution(incInfoIn) result(solution) +function grid_mechanical_FEM_solution(incInfoIn) result(solution) !-------------------------------------------------------------------------------------------------- ! input data for solution @@ -284,11 +299,13 @@ function grid_mech_FEM_solution(incInfoIn) result(solution) !-------------------------------------------------------------------------------------------------- ! solve BVP - call SNESsolve(mech_snes,PETSC_NULL_VEC,solution_current,ierr); CHKERRQ(ierr) + call SNESsolve(mechanical_snes,PETSC_NULL_VEC,solution_current,ierr) + CHKERRQ(ierr) !-------------------------------------------------------------------------------------------------- ! check convergence - call SNESGetConvergedReason(mech_snes,reason,ierr); CHKERRQ(ierr) + call SNESGetConvergedReason(mechanical_snes,reason,ierr) + CHKERRQ(ierr) solution%converged = reason > 0 solution%iterationsNeeded = totalIter @@ -296,14 +313,14 @@ function grid_mech_FEM_solution(incInfoIn) result(solution) terminallyIll = .false. P_aim = merge(P_aim,P_av,params%stress_mask) -end function grid_mech_FEM_solution +end function grid_mechanical_FEM_solution !-------------------------------------------------------------------------------------------------- !> @brief forwarding routine !> @details find new boundary conditions and best F estimate for end of current timestep !-------------------------------------------------------------------------------------------------- -subroutine grid_mech_FEM_forward(cutBack,guess,Delta_t,Delta_t_old,t_remaining,& +subroutine grid_mechanical_FEM_forward(cutBack,guess,Delta_t,Delta_t_old,t_remaining,& deformation_BC,stress_BC,rotation_BC) logical, intent(in) :: & @@ -323,8 +340,10 @@ subroutine grid_mech_FEM_forward(cutBack,guess,Delta_t,Delta_t_old,t_remaining,& u_current,u_lastInc - call DMDAVecGetArrayF90(mech_grid,solution_current,u_current,ierr); CHKERRQ(ierr) - call DMDAVecGetArrayF90(mech_grid,solution_lastInc,u_lastInc,ierr); CHKERRQ(ierr) + call DMDAVecGetArrayF90(mechanical_grid,solution_current,u_current,ierr) + CHKERRQ(ierr) + call DMDAVecGetArrayF90(mechanical_grid,solution_lastInc,u_lastInc,ierr) + CHKERRQ(ierr) if (cutBack) then C_volAvg = C_volAvgLastInc @@ -371,8 +390,10 @@ subroutine grid_mech_FEM_forward(cutBack,guess,Delta_t,Delta_t_old,t_remaining,& call VecAXPY(solution_current,Delta_t,solution_rate,ierr); CHKERRQ(ierr) - call DMDAVecRestoreArrayF90(mech_grid,solution_current,u_current,ierr); CHKERRQ(ierr) - call DMDAVecRestoreArrayF90(mech_grid,solution_lastInc,u_lastInc,ierr); CHKERRQ(ierr) + call DMDAVecRestoreArrayF90(mechanical_grid,solution_current,u_current,ierr) + CHKERRQ(ierr) + call DMDAVecRestoreArrayF90(mechanical_grid,solution_lastInc,u_lastInc,ierr) + CHKERRQ(ierr) !-------------------------------------------------------------------------------------------------- ! set module wide available data @@ -380,31 +401,33 @@ subroutine grid_mech_FEM_forward(cutBack,guess,Delta_t,Delta_t_old,t_remaining,& params%rotation_BC = rotation_BC params%timeinc = Delta_t -end subroutine grid_mech_FEM_forward +end subroutine grid_mechanical_FEM_forward !-------------------------------------------------------------------------------------------------- !> @brief Update coordinates !-------------------------------------------------------------------------------------------------- -subroutine grid_mech_FEM_updateCoords +subroutine grid_mechanical_FEM_updateCoords call utilities_updateCoords(F) -end subroutine grid_mech_FEM_updateCoords +end subroutine grid_mechanical_FEM_updateCoords !-------------------------------------------------------------------------------------------------- !> @brief Write current solver and constitutive data for restart to file !-------------------------------------------------------------------------------------------------- -subroutine grid_mech_FEM_restartWrite +subroutine grid_mechanical_FEM_restartWrite PetscErrorCode :: ierr integer(HID_T) :: fileHandle, groupHandle PetscScalar, dimension(:,:,:,:), pointer :: u_current,u_lastInc character(len=pStringLen) :: fileName - call DMDAVecGetArrayF90(mech_grid,solution_current,u_current,ierr); CHKERRQ(ierr) - call DMDAVecGetArrayF90(mech_grid,solution_lastInc,u_lastInc,ierr); CHKERRQ(ierr) + call DMDAVecGetArrayF90(mechanical_grid,solution_current,u_current,ierr) + CHKERRQ(ierr) + call DMDAVecGetArrayF90(mechanical_grid,solution_lastInc,u_lastInc,ierr) + CHKERRQ(ierr) print*, 'writing solver data required for restart to file'; flush(IO_STDOUT) @@ -427,10 +450,12 @@ subroutine grid_mech_FEM_restartWrite call HDF5_closeGroup(groupHandle) call HDF5_closeFile(fileHandle) - call DMDAVecRestoreArrayF90(mech_grid,solution_current,u_current,ierr);CHKERRQ(ierr) - call DMDAVecRestoreArrayF90(mech_grid,solution_lastInc,u_lastInc,ierr);CHKERRQ(ierr) + call DMDAVecRestoreArrayF90(mechanical_grid,solution_current,u_current,ierr) + CHKERRQ(ierr) + call DMDAVecRestoreArrayF90(mechanical_grid,solution_lastInc,u_lastInc,ierr) + CHKERRQ(ierr) -end subroutine grid_mech_FEM_restartWrite +end subroutine grid_mechanical_FEM_restartWrite !-------------------------------------------------------------------------------------------------- @@ -498,8 +523,10 @@ subroutine formResidual(da_local,x_local, & PetscErrorCode :: ierr real(pReal), dimension(3,3,3,3) :: devNull - call SNESGetNumberFunctionEvals(mech_snes,nfuncs,ierr); CHKERRQ(ierr) - call SNESGetIterationNumber(mech_snes,PETScIter,ierr); CHKERRQ(ierr) + call SNESGetNumberFunctionEvals(mechanical_snes,nfuncs,ierr) + CHKERRQ(ierr) + call SNESGetIterationNumber(mechanical_snes,PETScIter,ierr) + CHKERRQ(ierr) if (nfuncs == 0 .and. PETScIter == 0) totalIter = -1 ! new increment @@ -679,4 +706,4 @@ subroutine formJacobian(da_local,x_local,Jac_pre,Jac,dummy,ierr) end subroutine formJacobian -end module grid_mech_FEM +end module grid_mechanical_FEM diff --git a/src/grid/grid_mech_spectral_basic.f90 b/src/grid/grid_mech_spectral_basic.f90 index 9bc36165f..f3f30c0af 100644 --- a/src/grid/grid_mech_spectral_basic.f90 +++ b/src/grid/grid_mech_spectral_basic.f90 @@ -4,7 +4,7 @@ !> @author Philip Eisenlohr, Max-Planck-Institut für Eisenforschung GmbH !> @brief Grid solver for mechanics: Spectral basic !-------------------------------------------------------------------------------------------------- -module grid_mech_spectral_basic +module grid_mechanical_spectral_basic #include #include use PETScdmda @@ -79,18 +79,18 @@ module grid_mech_spectral_basic totalIter = 0 !< total iteration in current increment public :: & - grid_mech_spectral_basic_init, & - grid_mech_spectral_basic_solution, & - grid_mech_spectral_basic_forward, & - grid_mech_spectral_basic_updateCoords, & - grid_mech_spectral_basic_restartWrite + grid_mechanical_spectral_basic_init, & + grid_mechanical_spectral_basic_solution, & + grid_mechanical_spectral_basic_forward, & + grid_mechanical_spectral_basic_updateCoords, & + grid_mechanical_spectral_basic_restartWrite contains !-------------------------------------------------------------------------------------------------- !> @brief allocates all necessary fields and fills them with data, potentially from restart info !-------------------------------------------------------------------------------------------------- -subroutine grid_mech_spectral_basic_init +subroutine grid_mechanical_spectral_basic_init real(pReal), dimension(3,3,grid(1),grid(2),grid3) :: P PetscErrorCode :: ierr @@ -105,7 +105,7 @@ subroutine grid_mech_spectral_basic_init num_grid, & debug_grid - print'(/,a)', ' <<<+- grid_mech_spectral_basic init -+>>>'; flush(IO_STDOUT) + print'(/,a)', ' <<<+- grid_mechanical_spectral_basic init -+>>>'; flush(IO_STDOUT) print*, 'Eisenlohr et al., International Journal of Plasticity 46:37–53, 2013' print*, 'https://doi.org/10.1016/j.ijplas.2012.09.012'//IO_EOL @@ -139,7 +139,7 @@ subroutine grid_mech_spectral_basic_init !-------------------------------------------------------------------------------------------------- ! set default and user defined options for PETSc - call PetscOptionsInsertString(PETSC_NULL_OPTIONS,'-mech_snes_type ngmres',ierr) + call PetscOptionsInsertString(PETSC_NULL_OPTIONS,'-mechanical_snes_type ngmres',ierr) CHKERRQ(ierr) call PetscOptionsInsertString(PETSC_NULL_OPTIONS,num_grid%get_asString('petsc_options',defaultVal=''),ierr) CHKERRQ(ierr) @@ -152,7 +152,7 @@ subroutine grid_mech_spectral_basic_init !-------------------------------------------------------------------------------------------------- ! initialize solver specific parts of PETSc call SNESCreate(PETSC_COMM_WORLD,snes,ierr); CHKERRQ(ierr) - call SNESSetOptionsPrefix(snes,'mech_',ierr);CHKERRQ(ierr) + call SNESSetOptionsPrefix(snes,'mechanical_',ierr);CHKERRQ(ierr) localK = 0 localK(worldrank) = grid3 call MPI_Allreduce(MPI_IN_PLACE,localK,worldsize,MPI_INTEGER,MPI_SUM,PETSC_COMM_WORLD,ierr) @@ -222,13 +222,13 @@ subroutine grid_mech_spectral_basic_init call utilities_updateGamma(C_minMaxAvg) call utilities_saveReferenceStiffness -end subroutine grid_mech_spectral_basic_init +end subroutine grid_mechanical_spectral_basic_init !-------------------------------------------------------------------------------------------------- !> @brief solution for the basic scheme with internal iterations !-------------------------------------------------------------------------------------------------- -function grid_mech_spectral_basic_solution(incInfoIn) result(solution) +function grid_mechanical_spectral_basic_solution(incInfoIn) result(solution) !-------------------------------------------------------------------------------------------------- ! input data for solution @@ -262,14 +262,14 @@ function grid_mech_spectral_basic_solution(incInfoIn) result(solution) terminallyIll = .false. P_aim = merge(P_aim,P_av,params%stress_mask) -end function grid_mech_spectral_basic_solution +end function grid_mechanical_spectral_basic_solution !-------------------------------------------------------------------------------------------------- !> @brief forwarding routine !> @details find new boundary conditions and best F estimate for end of current timestep !-------------------------------------------------------------------------------------------------- -subroutine grid_mech_spectral_basic_forward(cutBack,guess,Delta_t,Delta_t_old,t_remaining,& +subroutine grid_mechanical_spectral_basic_forward(cutBack,guess,Delta_t,Delta_t_old,t_remaining,& deformation_BC,stress_BC,rotation_BC) logical, intent(in) :: & @@ -339,13 +339,13 @@ subroutine grid_mech_spectral_basic_forward(cutBack,guess,Delta_t,Delta_t_old,t_ params%rotation_BC = rotation_BC params%timeinc = Delta_t -end subroutine grid_mech_spectral_basic_forward +end subroutine grid_mechanical_spectral_basic_forward !-------------------------------------------------------------------------------------------------- !> @brief Update coordinates !-------------------------------------------------------------------------------------------------- -subroutine grid_mech_spectral_basic_updateCoords +subroutine grid_mechanical_spectral_basic_updateCoords PetscErrorCode :: ierr PetscScalar, dimension(:,:,:,:), pointer :: F @@ -354,13 +354,13 @@ subroutine grid_mech_spectral_basic_updateCoords call utilities_updateCoords(F) call DMDAVecRestoreArrayF90(da,solution_vec,F,ierr); CHKERRQ(ierr) -end subroutine grid_mech_spectral_basic_updateCoords +end subroutine grid_mechanical_spectral_basic_updateCoords !-------------------------------------------------------------------------------------------------- !> @brief Write current solver and constitutive data for restart to file !-------------------------------------------------------------------------------------------------- -subroutine grid_mech_spectral_basic_restartWrite +subroutine grid_mechanical_spectral_basic_restartWrite PetscErrorCode :: ierr integer(HID_T) :: fileHandle, groupHandle @@ -393,7 +393,7 @@ subroutine grid_mech_spectral_basic_restartWrite call DMDAVecRestoreArrayF90(da,solution_vec,F,ierr); CHKERRQ(ierr) -end subroutine grid_mech_spectral_basic_restartWrite +end subroutine grid_mechanical_spectral_basic_restartWrite !-------------------------------------------------------------------------------------------------- @@ -506,4 +506,4 @@ subroutine formResidual(in, F, & end subroutine formResidual -end module grid_mech_spectral_basic +end module grid_mechanical_spectral_basic diff --git a/src/grid/grid_mech_spectral_polarisation.f90 b/src/grid/grid_mech_spectral_polarisation.f90 index 7160c1adc..633fced7f 100644 --- a/src/grid/grid_mech_spectral_polarisation.f90 +++ b/src/grid/grid_mech_spectral_polarisation.f90 @@ -4,7 +4,7 @@ !> @author Philip Eisenlohr, Max-Planck-Institut für Eisenforschung GmbH !> @brief Grid solver for mechanics: Spectral Polarisation !-------------------------------------------------------------------------------------------------- -module grid_mech_spectral_polarisation +module grid_mechanical_spectral_polarisation #include #include use PETScdmda @@ -90,18 +90,18 @@ module grid_mech_spectral_polarisation totalIter = 0 !< total iteration in current increment public :: & - grid_mech_spectral_polarisation_init, & - grid_mech_spectral_polarisation_solution, & - grid_mech_spectral_polarisation_forward, & - grid_mech_spectral_polarisation_updateCoords, & - grid_mech_spectral_polarisation_restartWrite + grid_mechanical_spectral_polarisation_init, & + grid_mechanical_spectral_polarisation_solution, & + grid_mechanical_spectral_polarisation_forward, & + grid_mechanical_spectral_polarisation_updateCoords, & + grid_mechanical_spectral_polarisation_restartWrite contains !-------------------------------------------------------------------------------------------------- !> @brief allocates all necessary fields and fills them with data, potentially from restart info !-------------------------------------------------------------------------------------------------- -subroutine grid_mech_spectral_polarisation_init +subroutine grid_mechanical_spectral_polarisation_init real(pReal), dimension(3,3,grid(1),grid(2),grid3) :: P PetscErrorCode :: ierr @@ -118,7 +118,7 @@ subroutine grid_mech_spectral_polarisation_init num_grid, & debug_grid - print'(/,a)', ' <<<+- grid_mech_spectral_polarisation init -+>>>'; flush(IO_STDOUT) + print'(/,a)', ' <<<+- grid_mechanical_spectral_polarisation init -+>>>'; flush(IO_STDOUT) print*, 'Shanthraj et al., International Journal of Plasticity 66:31–45, 2015' print*, 'https://doi.org/10.1016/j.ijplas.2014.02.006' @@ -157,7 +157,7 @@ subroutine grid_mech_spectral_polarisation_init !-------------------------------------------------------------------------------------------------- ! set default and user defined options for PETSc - call PetscOptionsInsertString(PETSC_NULL_OPTIONS,'-mech_snes_type ngmres',ierr) + call PetscOptionsInsertString(PETSC_NULL_OPTIONS,'-mechanical_snes_type ngmres',ierr) CHKERRQ(ierr) call PetscOptionsInsertString(PETSC_NULL_OPTIONS,num_grid%get_asString('petsc_options',defaultVal=''),ierr) CHKERRQ(ierr) @@ -172,7 +172,7 @@ subroutine grid_mech_spectral_polarisation_init !-------------------------------------------------------------------------------------------------- ! initialize solver specific parts of PETSc call SNESCreate(PETSC_COMM_WORLD,snes,ierr); CHKERRQ(ierr) - call SNESSetOptionsPrefix(snes,'mech_',ierr);CHKERRQ(ierr) + call SNESSetOptionsPrefix(snes,'mechanical_',ierr);CHKERRQ(ierr) localK = 0 localK(worldrank) = grid3 call MPI_Allreduce(MPI_IN_PLACE,localK,worldsize,MPI_INTEGER,MPI_SUM,PETSC_COMM_WORLD,ierr) @@ -250,13 +250,13 @@ subroutine grid_mech_spectral_polarisation_init C_scale = C_minMaxAvg S_scale = math_invSym3333(C_minMaxAvg) -end subroutine grid_mech_spectral_polarisation_init +end subroutine grid_mechanical_spectral_polarisation_init !-------------------------------------------------------------------------------------------------- !> @brief solution for the Polarisation scheme with internal iterations !-------------------------------------------------------------------------------------------------- -function grid_mech_spectral_polarisation_solution(incInfoIn) result(solution) +function grid_mechanical_spectral_polarisation_solution(incInfoIn) result(solution) !-------------------------------------------------------------------------------------------------- ! input data for solution @@ -294,14 +294,14 @@ function grid_mech_spectral_polarisation_solution(incInfoIn) result(solution) terminallyIll = .false. P_aim = merge(P_aim,P_av,params%stress_mask) -end function grid_mech_spectral_polarisation_solution +end function grid_mechanical_spectral_polarisation_solution !-------------------------------------------------------------------------------------------------- !> @brief forwarding routine !> @details find new boundary conditions and best F estimate for end of current timestep !-------------------------------------------------------------------------------------------------- -subroutine grid_mech_spectral_polarisation_forward(cutBack,guess,Delta_t,Delta_t_old,t_remaining,& +subroutine grid_mechanical_spectral_polarisation_forward(cutBack,guess,Delta_t,Delta_t_old,t_remaining,& deformation_BC,stress_BC,rotation_BC) logical, intent(in) :: & @@ -393,13 +393,13 @@ subroutine grid_mech_spectral_polarisation_forward(cutBack,guess,Delta_t,Delta_t params%rotation_BC = rotation_BC params%timeinc = Delta_t -end subroutine grid_mech_spectral_polarisation_forward +end subroutine grid_mechanical_spectral_polarisation_forward !-------------------------------------------------------------------------------------------------- !> @brief Update coordinates !-------------------------------------------------------------------------------------------------- -subroutine grid_mech_spectral_polarisation_updateCoords +subroutine grid_mechanical_spectral_polarisation_updateCoords PetscErrorCode :: ierr PetscScalar, dimension(:,:,:,:), pointer :: FandF_tau @@ -408,13 +408,13 @@ subroutine grid_mech_spectral_polarisation_updateCoords call utilities_updateCoords(FandF_tau(0:8,:,:,:)) call DMDAVecRestoreArrayF90(da,solution_vec,FandF_tau,ierr); CHKERRQ(ierr) -end subroutine grid_mech_spectral_polarisation_updateCoords +end subroutine grid_mechanical_spectral_polarisation_updateCoords !-------------------------------------------------------------------------------------------------- !> @brief Write current solver and constitutive data for restart to file !-------------------------------------------------------------------------------------------------- -subroutine grid_mech_spectral_polarisation_restartWrite +subroutine grid_mechanical_spectral_polarisation_restartWrite PetscErrorCode :: ierr integer(HID_T) :: fileHandle, groupHandle @@ -450,7 +450,7 @@ subroutine grid_mech_spectral_polarisation_restartWrite call DMDAVecRestoreArrayF90(da,solution_vec,FandF_tau,ierr); CHKERRQ(ierr) -end subroutine grid_mech_spectral_polarisation_restartWrite +end subroutine grid_mechanical_spectral_polarisation_restartWrite !-------------------------------------------------------------------------------------------------- @@ -618,4 +618,4 @@ subroutine formResidual(in, FandF_tau, & end subroutine formResidual -end module grid_mech_spectral_polarisation +end module grid_mechanical_spectral_polarisation diff --git a/src/homogenization.f90 b/src/homogenization.f90 index 2255e83b0..62ac52f06 100644 --- a/src/homogenization.f90 +++ b/src/homogenization.f90 @@ -45,10 +45,10 @@ module homogenization !-------------------------------------------------------------------------------------------------- interface - module subroutine mech_init(num_homog) + module subroutine mechanical_init(num_homog) class(tNode), pointer, intent(in) :: & num_homog !< pointer to mechanical homogenization numerics data - end subroutine mech_init + end subroutine mechanical_init module subroutine thermal_init end subroutine thermal_init @@ -56,13 +56,13 @@ module homogenization module subroutine damage_init end subroutine damage_init - module subroutine mech_partition(subF,ip,el) + module subroutine mechanical_partition(subF,ip,el) real(pReal), intent(in), dimension(3,3) :: & subF integer, intent(in) :: & ip, & !< integration point el !< element number - end subroutine mech_partition + end subroutine mechanical_partition module subroutine thermal_partition(ce) integer, intent(in) :: ce @@ -76,19 +76,19 @@ module homogenization integer, intent(in) :: ip,el end subroutine thermal_homogenize - module subroutine mech_homogenize(dt,ip,el) + module subroutine mechanical_homogenize(dt,ip,el) real(pReal), intent(in) :: dt integer, intent(in) :: & ip, & !< integration point el !< element number - end subroutine mech_homogenize + end subroutine mechanical_homogenize - module subroutine mech_results(group_base,h) + module subroutine mechanical_results(group_base,h) character(len=*), intent(in) :: group_base integer, intent(in) :: h - end subroutine mech_results + end subroutine mechanical_results - module function mech_updateState(subdt,subF,ip,el) result(doneAndHappy) + module function mechanical_updateState(subdt,subF,ip,el) result(doneAndHappy) real(pReal), intent(in) :: & subdt !< current time step real(pReal), intent(in), dimension(3,3) :: & @@ -97,7 +97,7 @@ module homogenization ip, & !< integration point el !< element number logical, dimension(2) :: doneAndHappy - end function mech_updateState + end function mechanical_updateState module function thermal_conduction_getConductivity(ip,el) result(K) @@ -216,7 +216,7 @@ subroutine homogenization_init() if (num%nMPstate < 1) call IO_error(301,ext_msg='nMPstate') - call mech_init(num_homog) + call mechanical_init(num_homog) call thermal_init() call damage_init() @@ -253,7 +253,7 @@ subroutine materialpoint_stressAndItsTangent(dt,FEsolving_execIP,FEsolving_execE ce = (el-1)*discretization_nIPs + ip me = material_homogenizationMemberAt2(ce) - call constitutive_restore(ce,.false.) ! wrong name (is more a forward function) + call phase_restore(ce,.false.) ! wrong name (is more a forward function) if(homogState(ho)%sizeState > 0) homogState(ho)%State(:,me) = homogState(ho)%State0(:,me) if(damageState_h(ho)%sizeState > 0) damageState_h(ho)%State(:,me) = damageState_h(ho)%State0(:,me) @@ -267,7 +267,7 @@ subroutine materialpoint_stressAndItsTangent(dt,FEsolving_execIP,FEsolving_execE if (.not. doneAndHappy(1)) then - call mech_partition(homogenization_F(1:3,1:3,ce),ip,el) + call mechanical_partition(homogenization_F(1:3,1:3,ce),ip,el) converged = .true. do co = 1, myNgrains converged = converged .and. crystallite_stress(dt,co,ip,el) @@ -276,7 +276,7 @@ subroutine materialpoint_stressAndItsTangent(dt,FEsolving_execIP,FEsolving_execE if (.not. converged) then doneAndHappy = [.true.,.false.] else - doneAndHappy = mech_updateState(dt,homogenization_F(1:3,1:3,ce),ip,el) + doneAndHappy = mechanical_updateState(dt,homogenization_F(1:3,1:3,ce),ip,el) converged = all(doneAndHappy) endif endif @@ -338,7 +338,7 @@ subroutine materialpoint_stressAndItsTangent(dt,FEsolving_execIP,FEsolving_execE do co = 1, homogenization_Nconstituents(ho) call crystallite_orientations(co,ip,el) enddo - call mech_homogenize(dt,ip,el) + call mechanical_homogenize(dt,ip,el) enddo IpLooping3 enddo elementLooping3 !$OMP END DO @@ -365,7 +365,7 @@ subroutine homogenization_results group_base = 'current/homogenization/'//trim(material_name_homogenization(ho)) call results_closeGroup(results_addGroup(group_base)) - call mech_results(group_base,ho) + call mechanical_results(group_base,ho) group = trim(group_base)//'/damage' call results_closeGroup(results_addGroup(group)) diff --git a/src/homogenization_damage.f90 b/src/homogenization_damage.f90 index ba021a0e0..8b73ed54a 100644 --- a/src/homogenization_damage.f90 +++ b/src/homogenization_damage.f90 @@ -74,7 +74,7 @@ module subroutine damage_partition(ce) phi = current(material_homogenizationAt2(ce))%phi(material_homogenizationMemberAt2(ce)) do co = 1, homogenization_Nconstituents(material_homogenizationAt2(ce)) - call constitutive_damage_set_phi(phi,co,ce) + call phase_damage_set_phi(phi,co,ce) enddo end subroutine damage_partition @@ -120,7 +120,7 @@ module subroutine damage_nonlocal_getSourceAndItsTangent(phiDot, dPhiDot_dPhi, p phiDot = 0.0_pReal dPhiDot_dPhi = 0.0_pReal - call constitutive_damage_getRateAndItsTangents(phiDot, dPhiDot_dPhi, phi, ip, el) + call phase_damage_getRateAndItsTangents(phiDot, dPhiDot_dPhi, phi, ip, el) phiDot = phiDot/real(homogenization_Nconstituents(material_homogenizationAt(el)),pReal) dPhiDot_dPhi = dPhiDot_dPhi/real(homogenization_Nconstituents(material_homogenizationAt(el)),pReal) diff --git a/src/homogenization_mechanics.f90 b/src/homogenization_mechanical.f90 similarity index 79% rename from src/homogenization_mechanics.f90 rename to src/homogenization_mechanical.f90 index 4eae859ee..91e1d3d84 100644 --- a/src/homogenization_mechanics.f90 +++ b/src/homogenization_mechanical.f90 @@ -7,52 +7,52 @@ submodule(homogenization) mechanics interface - module subroutine mech_none_init - end subroutine mech_none_init + module subroutine mechanical_pass_init + end subroutine mechanical_pass_init - module subroutine mech_isostrain_init - end subroutine mech_isostrain_init + module subroutine mechanical_isostrain_init + end subroutine mechanical_isostrain_init - module subroutine mech_RGC_init(num_homogMech) + module subroutine mechanical_RGC_init(num_homogMech) class(tNode), pointer, intent(in) :: & num_homogMech !< pointer to mechanical homogenization numerics data - end subroutine mech_RGC_init + end subroutine mechanical_RGC_init - module subroutine mech_isostrain_partitionDeformation(F,avgF) + module subroutine mechanical_isostrain_partitionDeformation(F,avgF) real(pReal), dimension (:,:,:), intent(out) :: F !< partitioned deformation gradient real(pReal), dimension (3,3), intent(in) :: avgF !< average deformation gradient at material point - end subroutine mech_isostrain_partitionDeformation + end subroutine mechanical_isostrain_partitionDeformation - module subroutine mech_RGC_partitionDeformation(F,avgF,instance,of) + module subroutine mechanical_RGC_partitionDeformation(F,avgF,instance,of) real(pReal), dimension (:,:,:), intent(out) :: F !< partitioned deformation gradient real(pReal), dimension (3,3), intent(in) :: avgF !< average deformation gradient at material point integer, intent(in) :: & instance, & of - end subroutine mech_RGC_partitionDeformation + end subroutine mechanical_RGC_partitionDeformation - module subroutine mech_isostrain_averageStressAndItsTangent(avgP,dAvgPdAvgF,P,dPdF,instance) + module subroutine mechanical_isostrain_averageStressAndItsTangent(avgP,dAvgPdAvgF,P,dPdF,instance) real(pReal), dimension (3,3), intent(out) :: avgP !< average stress at material point real(pReal), dimension (3,3,3,3), intent(out) :: dAvgPdAvgF !< average stiffness at material point real(pReal), dimension (:,:,:), intent(in) :: P !< partitioned stresses real(pReal), dimension (:,:,:,:,:), intent(in) :: dPdF !< partitioned stiffnesses integer, intent(in) :: instance - end subroutine mech_isostrain_averageStressAndItsTangent + end subroutine mechanical_isostrain_averageStressAndItsTangent - module subroutine mech_RGC_averageStressAndItsTangent(avgP,dAvgPdAvgF,P,dPdF,instance) + module subroutine mechanical_RGC_averageStressAndItsTangent(avgP,dAvgPdAvgF,P,dPdF,instance) real(pReal), dimension (3,3), intent(out) :: avgP !< average stress at material point real(pReal), dimension (3,3,3,3), intent(out) :: dAvgPdAvgF !< average stiffness at material point real(pReal), dimension (:,:,:), intent(in) :: P !< partitioned stresses real(pReal), dimension (:,:,:,:,:), intent(in) :: dPdF !< partitioned stiffnesses integer, intent(in) :: instance - end subroutine mech_RGC_averageStressAndItsTangent + end subroutine mechanical_RGC_averageStressAndItsTangent - module function mech_RGC_updateState(P,F,avgF,dt,dPdF,ip,el) result(doneAndHappy) + module function mechanical_RGC_updateState(P,F,avgF,dt,dPdF,ip,el) result(doneAndHappy) logical, dimension(2) :: doneAndHappy real(pReal), dimension(:,:,:), intent(in) :: & P,& !< partitioned stresses @@ -63,13 +63,13 @@ submodule(homogenization) mechanics integer, intent(in) :: & ip, & !< integration point number el !< element number - end function mech_RGC_updateState + end function mechanical_RGC_updateState - module subroutine mech_RGC_results(instance,group) + module subroutine mechanical_RGC_results(instance,group) integer, intent(in) :: instance !< homogenization instance character(len=*), intent(in) :: group !< group name in HDF5 file - end subroutine mech_RGC_results + end subroutine mechanical_RGC_results end interface @@ -78,7 +78,7 @@ contains !-------------------------------------------------------------------------------------------------- !> @brief Allocate variables and set parameters. !-------------------------------------------------------------------------------------------------- -module subroutine mech_init(num_homog) +module subroutine mechanical_init(num_homog) class(tNode), pointer, intent(in) :: & num_homog @@ -94,17 +94,17 @@ module subroutine mech_init(num_homog) allocate(homogenization_P(3,3,discretization_nIPs*discretization_Nelems), source=0.0_pReal) num_homogMech => num_homog%get('mech',defaultVal=emptyDict) - if (any(homogenization_type == HOMOGENIZATION_NONE_ID)) call mech_none_init - if (any(homogenization_type == HOMOGENIZATION_ISOSTRAIN_ID)) call mech_isostrain_init - if (any(homogenization_type == HOMOGENIZATION_RGC_ID)) call mech_RGC_init(num_homogMech) + if (any(homogenization_type == HOMOGENIZATION_NONE_ID)) call mechanical_pass_init + if (any(homogenization_type == HOMOGENIZATION_ISOSTRAIN_ID)) call mechanical_isostrain_init + if (any(homogenization_type == HOMOGENIZATION_RGC_ID)) call mechanical_RGC_init(num_homogMech) -end subroutine mech_init +end subroutine mechanical_init !-------------------------------------------------------------------------------------------------- !> @brief Partition F onto the individual constituents. !-------------------------------------------------------------------------------------------------- -module subroutine mech_partition(subF,ip,el) +module subroutine mechanical_partition(subF,ip,el) real(pReal), intent(in), dimension(3,3) :: & subF @@ -122,25 +122,25 @@ module subroutine mech_partition(subF,ip,el) Fs(1:3,1:3,1) = subF case (HOMOGENIZATION_ISOSTRAIN_ID) chosenHomogenization - call mech_isostrain_partitionDeformation(Fs,subF) + call mechanical_isostrain_partitionDeformation(Fs,subF) case (HOMOGENIZATION_RGC_ID) chosenHomogenization - call mech_RGC_partitionDeformation(Fs,subF,ip,el) + call mechanical_RGC_partitionDeformation(Fs,subF,ip,el) end select chosenHomogenization do co = 1,homogenization_Nconstituents(material_homogenizationAt(el)) - call constitutive_mech_setF(Fs(1:3,1:3,co),co,ip,el) + call phase_mechanical_setF(Fs(1:3,1:3,co),co,ip,el) enddo -end subroutine mech_partition +end subroutine mechanical_partition !-------------------------------------------------------------------------------------------------- !> @brief Average P and dPdF from the individual constituents. !-------------------------------------------------------------------------------------------------- -module subroutine mech_homogenize(dt,ip,el) +module subroutine mechanical_homogenize(dt,ip,el) real(pReal), intent(in) :: dt integer, intent(in) :: & @@ -156,15 +156,15 @@ module subroutine mech_homogenize(dt,ip,el) chosenHomogenization: select case(homogenization_type(material_homogenizationAt(el))) case (HOMOGENIZATION_NONE_ID) chosenHomogenization - homogenization_P(1:3,1:3,ce) = constitutive_mech_getP(1,ip,el) - homogenization_dPdF(1:3,1:3,1:3,1:3,ce) = constitutive_mech_dPdF(dt,1,ip,el) + homogenization_P(1:3,1:3,ce) = phase_mechanical_getP(1,ip,el) + homogenization_dPdF(1:3,1:3,1:3,1:3,ce) = phase_mechanical_dPdF(dt,1,ip,el) case (HOMOGENIZATION_ISOSTRAIN_ID) chosenHomogenization do co = 1, homogenization_Nconstituents(material_homogenizationAt(el)) - dPdFs(:,:,:,:,co) = constitutive_mech_dPdF(dt,co,ip,el) - Ps(:,:,co) = constitutive_mech_getP(co,ip,el) + dPdFs(:,:,:,:,co) = phase_mechanical_dPdF(dt,co,ip,el) + Ps(:,:,co) = phase_mechanical_getP(co,ip,el) enddo - call mech_isostrain_averageStressAndItsTangent(& + call mechanical_isostrain_averageStressAndItsTangent(& homogenization_P(1:3,1:3,ce), & homogenization_dPdF(1:3,1:3,1:3,1:3,ce),& Ps,dPdFs, & @@ -172,10 +172,10 @@ module subroutine mech_homogenize(dt,ip,el) case (HOMOGENIZATION_RGC_ID) chosenHomogenization do co = 1, homogenization_Nconstituents(material_homogenizationAt(el)) - dPdFs(:,:,:,:,co) = constitutive_mech_dPdF(dt,co,ip,el) - Ps(:,:,co) = constitutive_mech_getP(co,ip,el) + dPdFs(:,:,:,:,co) = phase_mechanical_dPdF(dt,co,ip,el) + Ps(:,:,co) = phase_mechanical_getP(co,ip,el) enddo - call mech_RGC_averageStressAndItsTangent(& + call mechanical_RGC_averageStressAndItsTangent(& homogenization_P(1:3,1:3,ce), & homogenization_dPdF(1:3,1:3,1:3,1:3,ce),& Ps,dPdFs, & @@ -183,14 +183,14 @@ module subroutine mech_homogenize(dt,ip,el) end select chosenHomogenization -end subroutine mech_homogenize +end subroutine mechanical_homogenize !-------------------------------------------------------------------------------------------------- !> @brief update the internal state of the homogenization scheme and tell whether "done" and !> "happy" with result !-------------------------------------------------------------------------------------------------- -module function mech_updateState(subdt,subF,ip,el) result(doneAndHappy) +module function mechanical_updateState(subdt,subF,ip,el) result(doneAndHappy) real(pReal), intent(in) :: & subdt !< current time step @@ -209,22 +209,22 @@ module function mech_updateState(subdt,subF,ip,el) result(doneAndHappy) if (homogenization_type(material_homogenizationAt(el)) == HOMOGENIZATION_RGC_ID) then do co = 1, homogenization_Nconstituents(material_homogenizationAt(el)) - dPdFs(:,:,:,:,co) = constitutive_mech_dPdF(subdt,co,ip,el) - Fs(:,:,co) = constitutive_mech_getF(co,ip,el) - Ps(:,:,co) = constitutive_mech_getP(co,ip,el) + dPdFs(:,:,:,:,co) = phase_mechanical_dPdF(subdt,co,ip,el) + Fs(:,:,co) = phase_mechanical_getF(co,ip,el) + Ps(:,:,co) = phase_mechanical_getP(co,ip,el) enddo - doneAndHappy = mech_RGC_updateState(Ps,Fs,subF,subdt,dPdFs,ip,el) + doneAndHappy = mechanical_RGC_updateState(Ps,Fs,subF,subdt,dPdFs,ip,el) else doneAndHappy = .true. endif -end function mech_updateState +end function mechanical_updateState !-------------------------------------------------------------------------------------------------- !> @brief Write results to file. !-------------------------------------------------------------------------------------------------- -module subroutine mech_results(group_base,h) +module subroutine mechanical_results(group_base,h) use material, only: & material_homogenization_type => homogenization_type @@ -239,7 +239,7 @@ module subroutine mech_results(group_base,h) select case(material_homogenization_type(h)) case(HOMOGENIZATION_rgc_ID) - call mech_RGC_results(homogenization_typeInstance(h),group) + call mechanical_RGC_results(homogenization_typeInstance(h),group) end select @@ -250,7 +250,7 @@ module subroutine mech_results(group_base,h) !call results_writeDataset(group,temp,'P',& ! '1st Piola-Kirchhoff stress','Pa') -end subroutine mech_results +end subroutine mechanical_results end submodule mechanics diff --git a/src/homogenization_mechanics_RGC.f90 b/src/homogenization_mechanical_RGC.f90 similarity index 98% rename from src/homogenization_mechanics_RGC.f90 rename to src/homogenization_mechanical_RGC.f90 index 89a84314b..546c2b65c 100644 --- a/src/homogenization_mechanics_RGC.f90 +++ b/src/homogenization_mechanical_RGC.f90 @@ -71,7 +71,7 @@ contains !-------------------------------------------------------------------------------------------------- !> @brief allocates all necessary fields, reads information from material configuration file !-------------------------------------------------------------------------------------------------- -module subroutine mech_RGC_init(num_homogMech) +module subroutine mechanical_RGC_init(num_homogMech) class(tNode), pointer, intent(in) :: & num_homogMech !< pointer to mechanical homogenization numerics data @@ -155,7 +155,7 @@ module subroutine mech_RGC_init(num_homogMech) prm%N_constituents = homogMech%get_asInts('cluster_size',requiredSize=3) if (homogenization_Nconstituents(h) /= product(prm%N_constituents)) & - call IO_error(211,ext_msg='N_constituents (mech_RGC)') + call IO_error(211,ext_msg='N_constituents (mechanical_RGC)') prm%xi_alpha = homogMech%get_asFloat('xi_alpha') prm%c_alpha = homogMech%get_asFloat('c_alpha') @@ -190,13 +190,13 @@ module subroutine mech_RGC_init(num_homogMech) enddo -end subroutine mech_RGC_init +end subroutine mechanical_RGC_init !-------------------------------------------------------------------------------------------------- !> @brief partitions the deformation gradient onto the constituents !-------------------------------------------------------------------------------------------------- -module subroutine mech_RGC_partitionDeformation(F,avgF,instance,of) +module subroutine mechanical_RGC_partitionDeformation(F,avgF,instance,of) real(pReal), dimension (:,:,:), intent(out) :: F !< partitioned F per grain @@ -229,14 +229,14 @@ module subroutine mech_RGC_partitionDeformation(F,avgF,instance,of) end associate -end subroutine mech_RGC_partitionDeformation +end subroutine mechanical_RGC_partitionDeformation !-------------------------------------------------------------------------------------------------- !> @brief update the internal state of the homogenization scheme and tell whether "done" and ! "happy" with result !-------------------------------------------------------------------------------------------------- -module function mech_RGC_updateState(P,F,avgF,dt,dPdF,ip,el) result(doneAndHappy) +module function mechanical_RGC_updateState(P,F,avgF,dt,dPdF,ip,el) result(doneAndHappy) logical, dimension(2) :: doneAndHappy real(pReal), dimension(:,:,:), intent(in) :: & P,& !< partitioned stresses @@ -658,7 +658,7 @@ module function mech_RGC_updateState(P,F,avgF,dt,dPdF,ip,el) result(doneAndHappy real(pReal), dimension(6,6) :: C - C = constitutive_homogenizedC(material_phaseAt(grainID,el),material_phaseMemberAt(grainID,ip,el)) + C = phase_homogenizedC(material_phaseAt(grainID,el),material_phaseMemberAt(grainID,ip,el)) equivalentMu = lattice_equivalent_mu(C,'voigt') end function equivalentMu @@ -704,13 +704,13 @@ module function mech_RGC_updateState(P,F,avgF,dt,dPdF,ip,el) result(doneAndHappy end subroutine grainDeformation -end function mech_RGC_updateState +end function mechanical_RGC_updateState !-------------------------------------------------------------------------------------------------- !> @brief derive average stress and stiffness from constituent quantities !-------------------------------------------------------------------------------------------------- -module subroutine mech_RGC_averageStressAndItsTangent(avgP,dAvgPdAvgF,P,dPdF,instance) +module subroutine mechanical_RGC_averageStressAndItsTangent(avgP,dAvgPdAvgF,P,dPdF,instance) real(pReal), dimension (3,3), intent(out) :: avgP !< average stress at material point real(pReal), dimension (3,3,3,3), intent(out) :: dAvgPdAvgF !< average stiffness at material point @@ -722,13 +722,13 @@ module subroutine mech_RGC_averageStressAndItsTangent(avgP,dAvgPdAvgF,P,dPdF,ins avgP = sum(P,3) /real(product(param(instance)%N_constituents),pReal) dAvgPdAvgF = sum(dPdF,5)/real(product(param(instance)%N_constituents),pReal) -end subroutine mech_RGC_averageStressAndItsTangent +end subroutine mechanical_RGC_averageStressAndItsTangent !-------------------------------------------------------------------------------------------------- !> @brief writes results to HDF5 output file !-------------------------------------------------------------------------------------------------- -module subroutine mech_RGC_results(instance,group) +module subroutine mechanical_RGC_results(instance,group) integer, intent(in) :: instance character(len=*), intent(in) :: group @@ -754,7 +754,7 @@ module subroutine mech_RGC_results(instance,group) enddo outputsLoop end associate -end subroutine mech_RGC_results +end subroutine mechanical_RGC_results !-------------------------------------------------------------------------------------------------- diff --git a/src/homogenization_mechanics_isostrain.f90 b/src/homogenization_mechanical_isostrain.f90 similarity index 91% rename from src/homogenization_mechanics_isostrain.f90 rename to src/homogenization_mechanical_isostrain.f90 index 9634b2a38..f9616de42 100644 --- a/src/homogenization_mechanics_isostrain.f90 +++ b/src/homogenization_mechanical_isostrain.f90 @@ -26,7 +26,7 @@ contains !-------------------------------------------------------------------------------------------------- !> @brief allocates all neccessary fields, reads information from material configuration file !-------------------------------------------------------------------------------------------------- -module subroutine mech_isostrain_init +module subroutine mechanical_isostrain_init integer :: & Ninstances, & @@ -58,7 +58,7 @@ module subroutine mech_isostrain_init case ('avg') prm%mapping = average_ID case default - call IO_error(211,ext_msg='sum'//' (mech_isostrain)') + call IO_error(211,ext_msg='sum'//' (mechanical_isostrain)') end select Nmaterialpoints = count(material_homogenizationAt == h) @@ -70,13 +70,13 @@ module subroutine mech_isostrain_init enddo -end subroutine mech_isostrain_init +end subroutine mechanical_isostrain_init !-------------------------------------------------------------------------------------------------- !> @brief partitions the deformation gradient onto the constituents !-------------------------------------------------------------------------------------------------- -module subroutine mech_isostrain_partitionDeformation(F,avgF) +module subroutine mechanical_isostrain_partitionDeformation(F,avgF) real(pReal), dimension (:,:,:), intent(out) :: F !< partitioned deformation gradient @@ -84,13 +84,13 @@ module subroutine mech_isostrain_partitionDeformation(F,avgF) F = spread(avgF,3,size(F,3)) -end subroutine mech_isostrain_partitionDeformation +end subroutine mechanical_isostrain_partitionDeformation !-------------------------------------------------------------------------------------------------- !> @brief derive average stress and stiffness from constituent quantities !-------------------------------------------------------------------------------------------------- -module subroutine mech_isostrain_averageStressAndItsTangent(avgP,dAvgPdAvgF,P,dPdF,instance) +module subroutine mechanical_isostrain_averageStressAndItsTangent(avgP,dAvgPdAvgF,P,dPdF,instance) real(pReal), dimension (3,3), intent(out) :: avgP !< average stress at material point real(pReal), dimension (3,3,3,3), intent(out) :: dAvgPdAvgF !< average stiffness at material point @@ -112,6 +112,6 @@ module subroutine mech_isostrain_averageStressAndItsTangent(avgP,dAvgPdAvgF,P,dP end associate -end subroutine mech_isostrain_averageStressAndItsTangent +end subroutine mechanical_isostrain_averageStressAndItsTangent end submodule isostrain diff --git a/src/homogenization_mechanics_none.f90 b/src/homogenization_mechanical_pass.f90 similarity index 87% rename from src/homogenization_mechanics_none.f90 rename to src/homogenization_mechanical_pass.f90 index ebe2ea8f1..9e8f3e44c 100644 --- a/src/homogenization_mechanics_none.f90 +++ b/src/homogenization_mechanical_pass.f90 @@ -11,14 +11,14 @@ contains !-------------------------------------------------------------------------------------------------- !> @brief allocates all necessary fields, reads information from material configuration file !-------------------------------------------------------------------------------------------------- -module subroutine mech_none_init +module subroutine mechanical_pass_init integer :: & Ninstances, & h, & Nmaterialpoints - print'(/,a)', ' <<<+- homogenization:mechanics:none init -+>>>' + print'(/,a)', ' <<<+- homogenization:mechanics:pass init -+>>>' Ninstances = count(homogenization_type == HOMOGENIZATION_NONE_ID) print'(a,i2)', ' # instances: ',Ninstances; flush(IO_STDOUT) @@ -27,7 +27,7 @@ module subroutine mech_none_init if(homogenization_type(h) /= HOMOGENIZATION_NONE_ID) cycle if(homogenization_Nconstituents(h) /= 1) & - call IO_error(211,ext_msg='N_constituents (mech_none)') + call IO_error(211,ext_msg='N_constituents (mechanical_pass)') Nmaterialpoints = count(material_homogenizationAt == h) homogState(h)%sizeState = 0 @@ -36,6 +36,6 @@ module subroutine mech_none_init enddo -end subroutine mech_none_init +end subroutine mechanical_pass_init end submodule none diff --git a/src/homogenization_thermal.f90 b/src/homogenization_thermal.f90 index b7170e6ec..67027f52a 100644 --- a/src/homogenization_thermal.f90 +++ b/src/homogenization_thermal.f90 @@ -78,7 +78,7 @@ module subroutine thermal_partition(ce) T = current(material_homogenizationAt2(ce))%T(material_homogenizationMemberAt2(ce)) dot_T = current(material_homogenizationAt2(ce))%dot_T(material_homogenizationMemberAt2(ce)) do co = 1, homogenization_Nconstituents(material_homogenizationAt2(ce)) - call constitutive_thermal_setField(T,dot_T,co,ce) + call phase_thermal_setField(T,dot_T,co,ce) enddo end subroutine thermal_partition @@ -91,7 +91,7 @@ module subroutine thermal_homogenize(ip,el) integer, intent(in) :: ip,el - !call constitutive_thermal_getRate(homogenization_dot_T((el-1)*discretization_nIPs+ip), ip,el) + !call phase_thermal_getRate(homogenization_dot_T((el-1)*discretization_nIPs+ip), ip,el) end subroutine thermal_homogenize @@ -235,7 +235,7 @@ module subroutine thermal_conduction_getSource(Tdot, ip,el) do co = 1, homogenization_Nconstituents(ho) ph = material_phaseAt(co,el) me = material_phasememberAt(co,ip,el) - call constitutive_thermal_getRate(dot_T_temp, ph,me) + call phase_thermal_getRate(dot_T_temp, ph,me) Tdot = Tdot + dot_T_temp enddo diff --git a/src/mesh/DAMASK_mesh.f90 b/src/mesh/DAMASK_mesh.f90 index 7369520c1..5ef0f7a36 100644 --- a/src/mesh/DAMASK_mesh.f90 +++ b/src/mesh/DAMASK_mesh.f90 @@ -18,7 +18,7 @@ program DAMASK_mesh use config use discretization_mesh use FEM_Utilities - use mesh_mech_FEM + use mesh_mechanical_FEM implicit none @@ -242,7 +242,7 @@ program DAMASK_mesh do field = 1, nActiveFields select case (loadCases(1)%fieldBC(field)%ID) case(FIELD_MECH_ID) - call FEM_mech_init(loadCases(1)%fieldBC(field)) + call FEM_mechanical_init(loadCases(1)%fieldBC(field)) end select enddo @@ -306,7 +306,7 @@ program DAMASK_mesh do field = 1, nActiveFields select case (loadCases(currentLoadCase)%fieldBC(field)%ID) case(FIELD_MECH_ID) - call FEM_mech_forward (& + call FEM_mechanical_forward (& guess,timeinc,timeIncOld,loadCases(currentLoadCase)%fieldBC(field)) end select @@ -320,7 +320,7 @@ program DAMASK_mesh do field = 1, nActiveFields select case (loadCases(currentLoadCase)%fieldBC(field)%ID) case(FIELD_MECH_ID) - solres(field) = FEM_mech_solution (& + solres(field) = FEM_mechanical_solution (& incInfo,timeinc,timeIncOld,loadCases(currentLoadCase)%fieldBC(field)) end select diff --git a/src/mesh/FEM_utilities.f90 b/src/mesh/FEM_utilities.f90 index 2f3633e11..4b3be8a42 100644 --- a/src/mesh/FEM_utilities.f90 +++ b/src/mesh/FEM_utilities.f90 @@ -127,12 +127,12 @@ subroutine FEM_utilities_init CHKERRQ(ierr) if(debugPETSc) call PetscOptionsInsertString(PETSC_NULL_OPTIONS,trim(PETSCDEBUG),ierr) CHKERRQ(ierr) - call PetscOptionsInsertString(PETSC_NULL_OPTIONS,'-mech_snes_type newtonls & - &-mech_snes_linesearch_type cp -mech_snes_ksp_ew & - &-mech_snes_ksp_ew_rtol0 0.01 -mech_snes_ksp_ew_rtolmax 0.01 & - &-mech_ksp_type fgmres -mech_ksp_max_it 25 & - &-mech_pc_type ml -mech_mg_levels_ksp_type chebyshev & - &-mech_mg_levels_pc_type sor -mech_pc_ml_nullspace user',ierr) + call PetscOptionsInsertString(PETSC_NULL_OPTIONS,'-mechanical_snes_type newtonls & + &-mechanical_snes_linesearch_type cp -mechanical_snes_ksp_ew & + &-mechanical_snes_ksp_ew_rtol0 0.01 -mechanical_snes_ksp_ew_rtolmax 0.01 & + &-mechanical_ksp_type fgmres -mechanical_ksp_max_it 25 & + &-mechanical_pc_type ml -mechanical_mg_levels_ksp_type chebyshev & + &-mechanical_mg_levels_pc_type sor -mechanical_pc_ml_nullspace user',ierr) CHKERRQ(ierr) call PetscOptionsInsertString(PETSC_NULL_OPTIONS,num_mesh%get_asString('petsc_options',defaultVal=''),ierr) CHKERRQ(ierr) diff --git a/src/mesh/mesh_mech_FEM.f90 b/src/mesh/mesh_mech_FEM.f90 index e19c35998..c811d842b 100644 --- a/src/mesh/mesh_mech_FEM.f90 +++ b/src/mesh/mesh_mech_FEM.f90 @@ -4,7 +4,7 @@ !> @author Philip Eisenlohr, Max-Planck-Institut für Eisenforschung GmbH !> @brief FEM PETSc solver !-------------------------------------------------------------------------------------------------- -module mesh_mech_FEM +module mesh_mechanical_FEM #include #include #include @@ -50,7 +50,7 @@ module mesh_mech_FEM type(tNumerics), private :: num !-------------------------------------------------------------------------------------------------- ! PETSc data - SNES :: mech_snes + SNES :: mechanical_snes Vec :: solution, solution_rate, solution_local PetscInt :: dimPlex, cellDof, nQuadrature, nBasis PetscReal, allocatable, target :: qPoints(:), qWeights(:) @@ -65,20 +65,20 @@ module mesh_mech_FEM real(pReal), parameter :: eps = 1.0e-18_pReal public :: & - FEM_mech_init, & - FEM_mech_solution, & - FEM_mech_forward + FEM_mechanical_init, & + FEM_mechanical_solution, & + FEM_mechanical_forward contains !-------------------------------------------------------------------------------------------------- !> @brief allocates all neccessary fields and fills them with data !-------------------------------------------------------------------------------------------------- -subroutine FEM_mech_init(fieldBC) +subroutine FEM_mechanical_init(fieldBC) type(tFieldBC), intent(in) :: fieldBC - DM :: mech_mesh + DM :: mechanical_mesh PetscFE :: mechFE PetscQuadrature :: mechQuad, functional PetscDS :: mechDS @@ -126,8 +126,8 @@ subroutine FEM_mech_init(fieldBC) !-------------------------------------------------------------------------------------------------- ! Setup FEM mech mesh - call DMClone(geomMesh,mech_mesh,ierr); CHKERRQ(ierr) - call DMGetDimension(mech_mesh,dimPlex,ierr); CHKERRQ(ierr) + call DMClone(geomMesh,mechanical_mesh,ierr); CHKERRQ(ierr) + call DMGetDimension(mechanical_mesh,dimPlex,ierr); CHKERRQ(ierr) !-------------------------------------------------------------------------------------------------- ! Setup FEM mech discretization @@ -146,22 +146,22 @@ subroutine FEM_mech_init(fieldBC) call PetscFESetQuadrature(mechFE,mechQuad,ierr); CHKERRQ(ierr) call PetscFEGetDimension(mechFE,nBasis,ierr); CHKERRQ(ierr) nBasis = nBasis/nc - call DMAddField(mech_mesh,PETSC_NULL_DMLABEL,mechFE,ierr); CHKERRQ(ierr) - call DMCreateDS(mech_mesh,ierr); CHKERRQ(ierr) - call DMGetDS(mech_mesh,mechDS,ierr); CHKERRQ(ierr) + call DMAddField(mechanical_mesh,PETSC_NULL_DMLABEL,mechFE,ierr); CHKERRQ(ierr) + call DMCreateDS(mechanical_mesh,ierr); CHKERRQ(ierr) + call DMGetDS(mechanical_mesh,mechDS,ierr); CHKERRQ(ierr) call PetscDSGetTotalDimension(mechDS,cellDof,ierr); CHKERRQ(ierr) call PetscFEDestroy(mechFE,ierr); CHKERRQ(ierr) call PetscQuadratureDestroy(mechQuad,ierr); CHKERRQ(ierr) !-------------------------------------------------------------------------------------------------- ! Setup FEM mech boundary conditions - call DMGetLabel(mech_mesh,'Face Sets',BCLabel,ierr); CHKERRQ(ierr) - call DMPlexLabelComplete(mech_mesh,BCLabel,ierr); CHKERRQ(ierr) - call DMGetLocalSection(mech_mesh,section,ierr); CHKERRQ(ierr) + call DMGetLabel(mechanical_mesh,'Face Sets',BCLabel,ierr); CHKERRQ(ierr) + call DMPlexLabelComplete(mechanical_mesh,BCLabel,ierr); CHKERRQ(ierr) + call DMGetLocalSection(mechanical_mesh,section,ierr); CHKERRQ(ierr) allocate(pnumComp(1), source=dimPlex) allocate(pnumDof(0:dimPlex), source = 0) do topologDim = 0, dimPlex - call DMPlexGetDepthStratum(mech_mesh,topologDim,cellStart,cellEnd,ierr) + call DMPlexGetDepthStratum(mechanical_mesh,topologDim,cellStart,cellEnd,ierr) CHKERRQ(ierr) call PetscSectionGetDof(section,cellStart,pnumDof(topologDim),ierr) CHKERRQ(ierr) @@ -179,10 +179,10 @@ subroutine FEM_mech_init(fieldBC) numBC = numBC + 1 call ISCreateGeneral(PETSC_COMM_WORLD,1,[field-1],PETSC_COPY_VALUES,pbcComps(numBC),ierr) CHKERRQ(ierr) - call DMGetStratumSize(mech_mesh,'Face Sets',mesh_boundaries(faceSet),bcSize,ierr) + call DMGetStratumSize(mechanical_mesh,'Face Sets',mesh_boundaries(faceSet),bcSize,ierr) CHKERRQ(ierr) if (bcSize > 0) then - call DMGetStratumIS(mech_mesh,'Face Sets',mesh_boundaries(faceSet),bcPoint,ierr) + call DMGetStratumIS(mechanical_mesh,'Face Sets',mesh_boundaries(faceSet),bcPoint,ierr) CHKERRQ(ierr) call ISGetIndicesF90(bcPoint,pBcPoint,ierr); CHKERRQ(ierr) call ISCreateGeneral(PETSC_COMM_WORLD,bcSize,pBcPoint,PETSC_COPY_VALUES,pbcPoints(numBC),ierr) @@ -195,32 +195,32 @@ subroutine FEM_mech_init(fieldBC) endif endif enddo; enddo - call DMPlexCreateSection(mech_mesh,nolabel,pNumComp,pNumDof, & + call DMPlexCreateSection(mechanical_mesh,nolabel,pNumComp,pNumDof, & numBC,pBcField,pBcComps,pBcPoints,PETSC_NULL_IS,section,ierr) CHKERRQ(ierr) - call DMSetSection(mech_mesh,section,ierr); CHKERRQ(ierr) + call DMSetSection(mechanical_mesh,section,ierr); CHKERRQ(ierr) do faceSet = 1, numBC call ISDestroy(pbcPoints(faceSet),ierr); CHKERRQ(ierr) enddo !-------------------------------------------------------------------------------------------------- ! initialize solver specific parts of PETSc - call SNESCreate(PETSC_COMM_WORLD,mech_snes,ierr);CHKERRQ(ierr) - call SNESSetOptionsPrefix(mech_snes,'mech_',ierr);CHKERRQ(ierr) - call SNESSetDM(mech_snes,mech_mesh,ierr); CHKERRQ(ierr) !< set the mesh for non-linear solver - call DMCreateGlobalVector(mech_mesh,solution ,ierr); CHKERRQ(ierr) !< locally owned displacement Dofs - call DMCreateGlobalVector(mech_mesh,solution_rate ,ierr); CHKERRQ(ierr) !< locally owned velocity Dofs to guess solution at next load step - call DMCreateLocalVector (mech_mesh,solution_local ,ierr); CHKERRQ(ierr) !< locally owned velocity Dofs to guess solution at next load step - call DMSNESSetFunctionLocal(mech_mesh,FEM_mech_formResidual,PETSC_NULL_VEC,ierr) !< function to evaluate residual forces + call SNESCreate(PETSC_COMM_WORLD,mechanical_snes,ierr);CHKERRQ(ierr) + call SNESSetOptionsPrefix(mechanical_snes,'mechanical_',ierr);CHKERRQ(ierr) + call SNESSetDM(mechanical_snes,mechanical_mesh,ierr); CHKERRQ(ierr) !< set the mesh for non-linear solver + call DMCreateGlobalVector(mechanical_mesh,solution ,ierr); CHKERRQ(ierr) !< locally owned displacement Dofs + call DMCreateGlobalVector(mechanical_mesh,solution_rate ,ierr); CHKERRQ(ierr) !< locally owned velocity Dofs to guess solution at next load step + call DMCreateLocalVector (mechanical_mesh,solution_local ,ierr); CHKERRQ(ierr) !< locally owned velocity Dofs to guess solution at next load step + call DMSNESSetFunctionLocal(mechanical_mesh,FEM_mechanical_formResidual,PETSC_NULL_VEC,ierr) !< function to evaluate residual forces CHKERRQ(ierr) - call DMSNESSetJacobianLocal(mech_mesh,FEM_mech_formJacobian,PETSC_NULL_VEC,ierr) !< function to evaluate stiffness matrix + call DMSNESSetJacobianLocal(mechanical_mesh,FEM_mechanical_formJacobian,PETSC_NULL_VEC,ierr) !< function to evaluate stiffness matrix CHKERRQ(ierr) - call SNESSetMaxLinearSolveFailures(mech_snes, huge(1), ierr); CHKERRQ(ierr) !< ignore linear solve failures - call SNESSetConvergenceTest(mech_snes,FEM_mech_converged,PETSC_NULL_VEC,PETSC_NULL_FUNCTION,ierr) + call SNESSetMaxLinearSolveFailures(mechanical_snes, huge(1), ierr); CHKERRQ(ierr) !< ignore linear solve failures + call SNESSetConvergenceTest(mechanical_snes,FEM_mechanical_converged,PETSC_NULL_VEC,PETSC_NULL_FUNCTION,ierr) CHKERRQ(ierr) - call SNESSetTolerances(mech_snes,1.0,0.0,0.0,num%itmax,num%itmax,ierr) + call SNESSetTolerances(mechanical_snes,1.0,0.0,0.0,num%itmax,num%itmax,ierr) CHKERRQ(ierr) - call SNESSetFromOptions(mech_snes,ierr); CHKERRQ(ierr) + call SNESSetFromOptions(mechanical_snes,ierr); CHKERRQ(ierr) !-------------------------------------------------------------------------------------------------- ! init fields @@ -236,11 +236,11 @@ subroutine FEM_mech_init(fieldBC) call PetscDSGetDiscretization(mechDS,0,mechFE,ierr) CHKERRQ(ierr) call PetscFEGetDualSpace(mechFE,mechDualSpace,ierr); CHKERRQ(ierr) - call DMPlexGetHeightStratum(mech_mesh,0,cellStart,cellEnd,ierr) + call DMPlexGetHeightStratum(mechanical_mesh,0,cellStart,cellEnd,ierr) CHKERRQ(ierr) do cell = cellStart, cellEnd-1 !< loop over all elements x_scal = 0.0_pReal - call DMPlexComputeCellGeometryAffineFEM(mech_mesh,cell,pV0,pCellJ,pInvcellJ,detJ,ierr) + call DMPlexComputeCellGeometryAffineFEM(mechanical_mesh,cell,pV0,pCellJ,pInvcellJ,detJ,ierr) CHKERRQ(ierr) cellJMat = reshape(pCellJ,shape=[dimPlex,dimPlex]) do basis = 0, nBasis*dimPlex-1, dimPlex @@ -251,17 +251,17 @@ subroutine FEM_mech_init(fieldBC) x_scal(basis+1:basis+dimPlex) = pV0 + matmul(transpose(cellJMat),nodalPointsP + 1.0_pReal) enddo px_scal => x_scal - call DMPlexVecSetClosure(mech_mesh,section,solution_local,cell,px_scal,5,ierr) + call DMPlexVecSetClosure(mechanical_mesh,section,solution_local,cell,px_scal,5,ierr) CHKERRQ(ierr) enddo -end subroutine FEM_mech_init +end subroutine FEM_mechanical_init !-------------------------------------------------------------------------------------------------- !> @brief solution for the FEM load step !-------------------------------------------------------------------------------------------------- -type(tSolutionState) function FEM_mech_solution( & +type(tSolutionState) function FEM_mechanical_solution( & incInfoIn,timeinc,timeinc_old,fieldBC) !-------------------------------------------------------------------------------------------------- @@ -278,35 +278,35 @@ type(tSolutionState) function FEM_mech_solution( & SNESConvergedReason :: reason incInfo = incInfoIn - FEM_mech_solution%converged =.false. + FEM_mechanical_solution%converged =.false. !-------------------------------------------------------------------------------------------------- ! set module wide availabe data params%timeinc = timeinc params%fieldBC = fieldBC - call SNESSolve(mech_snes,PETSC_NULL_VEC,solution,ierr); CHKERRQ(ierr) ! solve mech_snes based on solution guess (result in solution) - call SNESGetConvergedReason(mech_snes,reason,ierr); CHKERRQ(ierr) ! solution converged? + call SNESSolve(mechanical_snes,PETSC_NULL_VEC,solution,ierr); CHKERRQ(ierr) ! solve mechanical_snes based on solution guess (result in solution) + call SNESGetConvergedReason(mechanical_snes,reason,ierr); CHKERRQ(ierr) ! solution converged? terminallyIll = .false. if (reason < 1) then ! 0: still iterating (will not occur), negative -> convergence error - FEM_mech_solution%converged = .false. - FEM_mech_solution%iterationsNeeded = num%itmax + FEM_mechanical_solution%converged = .false. + FEM_mechanical_solution%iterationsNeeded = num%itmax else ! >= 1 proper convergence (or terminally ill) - FEM_mech_solution%converged = .true. - call SNESGetIterationNumber(mech_snes,FEM_mech_solution%iterationsNeeded,ierr) + FEM_mechanical_solution%converged = .true. + call SNESGetIterationNumber(mechanical_snes,FEM_mechanical_solution%iterationsNeeded,ierr) CHKERRQ(ierr) endif print'(/,a)', ' ===========================================================================' flush(IO_STDOUT) -end function FEM_mech_solution +end function FEM_mechanical_solution !-------------------------------------------------------------------------------------------------- !> @brief forms the FEM residual vector !-------------------------------------------------------------------------------------------------- -subroutine FEM_mech_formResidual(dm_local,xx_local,f_local,dummy,ierr) +subroutine FEM_mechanical_formResidual(dm_local,xx_local,f_local,dummy,ierr) DM :: dm_local PetscObject,intent(in) :: dummy @@ -431,13 +431,13 @@ subroutine FEM_mech_formResidual(dm_local,xx_local,f_local,dummy,ierr) enddo call DMRestoreLocalVector(dm_local,x_local,ierr); CHKERRQ(ierr) -end subroutine FEM_mech_formResidual +end subroutine FEM_mechanical_formResidual !-------------------------------------------------------------------------------------------------- !> @brief forms the FEM stiffness matrix !-------------------------------------------------------------------------------------------------- -subroutine FEM_mech_formJacobian(dm_local,xx_local,Jac_pre,Jac,dummy,ierr) +subroutine FEM_mechanical_formJacobian(dm_local,xx_local,Jac_pre,Jac,dummy,ierr) DM :: dm_local @@ -575,13 +575,13 @@ subroutine FEM_mech_formJacobian(dm_local,xx_local,Jac_pre,Jac,dummy,ierr) call MatSetNearNullSpace(Jac,matnull,ierr); CHKERRQ(ierr) call MatNullSpaceDestroy(matnull,ierr); CHKERRQ(ierr) -end subroutine FEM_mech_formJacobian +end subroutine FEM_mechanical_formJacobian !-------------------------------------------------------------------------------------------------- !> @brief forwarding routine !-------------------------------------------------------------------------------------------------- -subroutine FEM_mech_forward(guess,timeinc,timeinc_old,fieldBC) +subroutine FEM_mechanical_forward(guess,timeinc,timeinc_old,fieldBC) type(tFieldBC), intent(in) :: & fieldBC @@ -603,7 +603,7 @@ subroutine FEM_mech_forward(guess,timeinc,timeinc_old,fieldBC) if (guess .and. .not. cutBack) then ForwardData = .True. homogenization_F0 = homogenization_F - call SNESGetDM(mech_snes,dm_local,ierr); CHKERRQ(ierr) !< retrieve mesh info from mech_snes into dm_local + call SNESGetDM(mechanical_snes,dm_local,ierr); CHKERRQ(ierr) !< retrieve mesh info from mechanical_snes into dm_local call DMGetSection(dm_local,section,ierr); CHKERRQ(ierr) call DMGetLocalVector(dm_local,x_local,ierr); CHKERRQ(ierr) call VecSet(x_local,0.0_pReal,ierr); CHKERRQ(ierr) @@ -634,13 +634,13 @@ subroutine FEM_mech_forward(guess,timeinc,timeinc_old,fieldBC) call VecCopy(solution_rate,solution,ierr); CHKERRQ(ierr) call VecScale(solution,timeinc,ierr); CHKERRQ(ierr) -end subroutine FEM_mech_forward +end subroutine FEM_mechanical_forward !-------------------------------------------------------------------------------------------------- !> @brief reporting !-------------------------------------------------------------------------------------------------- -subroutine FEM_mech_converged(snes_local,PETScIter,xnorm,snorm,fnorm,reason,dummy,ierr) +subroutine FEM_mechanical_converged(snes_local,PETScIter,xnorm,snorm,fnorm,reason,dummy,ierr) SNES :: snes_local PetscInt :: PETScIter @@ -662,6 +662,6 @@ subroutine FEM_mech_converged(snes_local,PETScIter,xnorm,snorm,fnorm,reason,dumm ' Piola--Kirchhoff stress / MPa =',transpose(P_av)*1.e-6_pReal flush(IO_STDOUT) -end subroutine FEM_mech_converged +end subroutine FEM_mechanical_converged -end module mesh_mech_FEM +end module mesh_mechanical_FEM diff --git a/src/phase.f90 b/src/phase.f90 index dd14e0831..628bfc443 100644 --- a/src/phase.f90 +++ b/src/phase.f90 @@ -62,7 +62,7 @@ module phase 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_plasticInstance, & !< instance of particular plasticity of each phase phase_elasticityInstance !< instance of particular elasticity of each phase logical, dimension(:), allocatable, public :: & ! ToDo: should be protected (bug in Intel Compiler) @@ -75,15 +75,15 @@ module phase integer, public, protected :: & - constitutive_plasticity_maxSizeDotState, & - constitutive_source_maxSizeDotState + phase_plasticity_maxSizeDotState, & + phase_source_maxSizeDotState interface ! == cleaned:begin ================================================================================= - module subroutine mech_init(phases) + module subroutine mechanical_init(phases) class(tNode), pointer :: phases - end subroutine mech_init + end subroutine mechanical_init module subroutine damage_init end subroutine damage_init @@ -93,83 +93,83 @@ module phase end subroutine thermal_init - module subroutine mech_results(group,ph) + module subroutine mechanical_results(group,ph) character(len=*), intent(in) :: group integer, intent(in) :: ph - end subroutine mech_results + end subroutine mechanical_results module subroutine damage_results(group,ph) character(len=*), intent(in) :: group integer, intent(in) :: ph end subroutine damage_results - module subroutine mech_windForward(ph,me) + module subroutine mechanical_windForward(ph,me) integer, intent(in) :: ph, me - end subroutine mech_windForward + end subroutine mechanical_windForward - module subroutine mech_forward() - end subroutine mech_forward + module subroutine mechanical_forward() + end subroutine mechanical_forward module subroutine thermal_forward() end subroutine thermal_forward - module subroutine mech_restore(ce,includeL) + module subroutine mechanical_restore(ce,includeL) integer, intent(in) :: ce logical, intent(in) :: includeL - end subroutine mech_restore + end subroutine mechanical_restore - module function constitutive_mech_dPdF(dt,co,ip,el) result(dPdF) + module function phase_mechanical_dPdF(dt,co,ip,el) result(dPdF) real(pReal), intent(in) :: dt integer, intent(in) :: & co, & !< counter in constituent loop ip, & !< counter in integration point loop el !< counter in element loop real(pReal), dimension(3,3,3,3) :: dPdF - end function constitutive_mech_dPdF + end function phase_mechanical_dPdF - module subroutine mech_restartWrite(groupHandle,ph) + module subroutine mechanical_restartWrite(groupHandle,ph) integer(HID_T), intent(in) :: groupHandle integer, intent(in) :: ph - end subroutine mech_restartWrite + end subroutine mechanical_restartWrite - module subroutine mech_restartRead(groupHandle,ph) + module subroutine mechanical_restartRead(groupHandle,ph) integer(HID_T), intent(in) :: groupHandle integer, intent(in) :: ph - end subroutine mech_restartRead + end subroutine mechanical_restartRead - module function mech_S(ph,me) result(S) + module function mechanical_S(ph,me) result(S) integer, intent(in) :: ph,me real(pReal), dimension(3,3) :: S - end function mech_S + end function mechanical_S - module function mech_L_p(ph,me) result(L_p) + module function mechanical_L_p(ph,me) result(L_p) integer, intent(in) :: ph,me real(pReal), dimension(3,3) :: L_p - end function mech_L_p + end function mechanical_L_p - module function constitutive_mech_getF(co,ip,el) result(F) + module function phase_mechanical_getF(co,ip,el) result(F) integer, intent(in) :: co, ip, el real(pReal), dimension(3,3) :: F - end function constitutive_mech_getF + end function phase_mechanical_getF - module function mech_F_e(ph,me) result(F_e) + module function mechanical_F_e(ph,me) result(F_e) integer, intent(in) :: ph,me real(pReal), dimension(3,3) :: F_e - end function mech_F_e + end function mechanical_F_e - module function constitutive_mech_getP(co,ip,el) result(P) + module function phase_mechanical_getP(co,ip,el) result(P) integer, intent(in) :: co, ip, el real(pReal), dimension(3,3) :: P - end function constitutive_mech_getP + end function phase_mechanical_getP - module function constitutive_damage_get_phi(co,ip,el) result(phi) + module function phase_damage_get_phi(co,ip,el) result(phi) integer, intent(in) :: co, ip, el real(pReal) :: phi - end function constitutive_damage_get_phi + end function phase_damage_get_phi module function thermal_T(ph,me) result(T) integer, intent(in) :: ph,me @@ -182,20 +182,20 @@ module phase end function thermal_dot_T - module subroutine constitutive_mech_setF(F,co,ip,el) + module subroutine phase_mechanical_setF(F,co,ip,el) real(pReal), dimension(3,3), intent(in) :: F integer, intent(in) :: co, ip, el - end subroutine constitutive_mech_setF + end subroutine phase_mechanical_setF - module subroutine constitutive_thermal_setField(T,dot_T, co,ce) + module subroutine phase_thermal_setField(T,dot_T, co,ce) real(pReal), intent(in) :: T, dot_T integer, intent(in) :: ce, co - end subroutine constitutive_thermal_setField + end subroutine phase_thermal_setField - module subroutine constitutive_damage_set_phi(phi,co,ce) + module subroutine phase_damage_set_phi(phi,co,ce) real(pReal), intent(in) :: phi integer, intent(in) :: co, ce - end subroutine constitutive_damage_set_phi + end subroutine phase_damage_set_phi ! == cleaned:end =================================================================================== @@ -222,13 +222,13 @@ module phase logical :: converged_ end function crystallite_stress - module function constitutive_homogenizedC(ph,me) result(C) + module function phase_homogenizedC(ph,me) result(C) integer, intent(in) :: ph, me real(pReal), dimension(6,6) :: C - end function constitutive_homogenizedC + end function phase_homogenizedC - module subroutine constitutive_damage_getRateAndItsTangents(phiDot, dPhiDot_dPhi, phi, ip, el) + module subroutine phase_damage_getRateAndItsTangents(phiDot, dPhiDot_dPhi, phi, ip, el) integer, intent(in) :: & ip, & !< integration point number el !< element number @@ -237,13 +237,13 @@ module phase real(pReal), intent(inout) :: & phiDot, & dPhiDot_dPhi - end subroutine constitutive_damage_getRateAndItsTangents + end subroutine phase_damage_getRateAndItsTangents - module subroutine constitutive_thermal_getRate(TDot, ph,me) + module subroutine phase_thermal_getRate(TDot, ph,me) integer, intent(in) :: ph, me real(pReal), intent(out) :: & TDot - end subroutine constitutive_thermal_getRate + end subroutine phase_thermal_getRate module subroutine plastic_nonlocal_updateCompatibility(orientation,instance,i,e) integer, intent(in) :: & @@ -281,39 +281,39 @@ module phase #endif public :: & - constitutive_init, & - constitutive_homogenizedC, & - constitutive_damage_getRateAndItsTangents, & - constitutive_thermal_getRate, & - constitutive_results, & - constitutive_allocateState, & - constitutive_forward, & - constitutive_restore, & + phase_init, & + phase_homogenizedC, & + phase_damage_getRateAndItsTangents, & + phase_thermal_getRate, & + phase_results, & + phase_allocateState, & + phase_forward, & + phase_restore, & plastic_nonlocal_updateCompatibility, & converged, & crystallite_init, & crystallite_stress, & thermal_stress, & - constitutive_mech_dPdF, & + phase_mechanical_dPdF, & crystallite_orientations, & crystallite_push33ToRef, & - constitutive_restartWrite, & - constitutive_restartRead, & + phase_restartWrite, & + phase_restartRead, & integrateDamageState, & - constitutive_thermal_setField, & - constitutive_damage_set_phi, & - constitutive_damage_get_phi, & - constitutive_mech_getP, & - constitutive_mech_setF, & - constitutive_mech_getF, & - constitutive_windForward + phase_thermal_setField, & + phase_damage_set_phi, & + phase_damage_get_phi, & + phase_mechanical_getP, & + phase_mechanical_setF, & + phase_mechanical_getF, & + phase_windForward contains !-------------------------------------------------------------------------------------------------- !> @brief Initialze constitutive models for individual physics !-------------------------------------------------------------------------------------------------- -subroutine constitutive_init +subroutine phase_init integer :: & ph, & !< counter in phase loop @@ -336,12 +336,12 @@ subroutine constitutive_init phases => config_material%get('phase') - call mech_init(phases) + call mechanical_init(phases) call damage_init call thermal_init(phases) - constitutive_source_maxSizeDotState = 0 + phase_source_maxSizeDotState = 0 PhaseLoop2:do ph = 1,phases%length !-------------------------------------------------------------------------------------------------- ! partition and initialize state @@ -350,18 +350,18 @@ subroutine constitutive_init damageState(ph)%p(so)%state = damageState(ph)%p(so)%state0 end forall - constitutive_source_maxSizeDotState = max(constitutive_source_maxSizeDotState, & + phase_source_maxSizeDotState = max(phase_source_maxSizeDotState, & maxval(damageState(ph)%p%sizeDotState)) enddo PhaseLoop2 - constitutive_plasticity_maxSizeDotState = maxval(plasticState%sizeDotState) + phase_plasticity_maxSizeDotState = maxval(plasticState%sizeDotState) -end subroutine constitutive_init +end subroutine phase_init !-------------------------------------------------------------------------------------------------- !> @brief Allocate the components of the state structure for a given phase !-------------------------------------------------------------------------------------------------- -subroutine constitutive_allocateState(state, & +subroutine phase_allocateState(state, & Nconstituents,sizeState,sizeDotState,sizeDeltaState) class(tState), intent(out) :: & @@ -387,13 +387,13 @@ subroutine constitutive_allocateState(state, & allocate(state%deltaState (sizeDeltaState,Nconstituents), source=0.0_pReal) -end subroutine constitutive_allocateState +end subroutine phase_allocateState !-------------------------------------------------------------------------------------------------- !> @brief Restore data after homog cutback. !-------------------------------------------------------------------------------------------------- -subroutine constitutive_restore(ce,includeL) +subroutine phase_restore(ce,includeL) logical, intent(in) :: includeL integer, intent(in) :: ce @@ -410,21 +410,21 @@ subroutine constitutive_restore(ce,includeL) enddo enddo - call mech_restore(ce,includeL) + call mechanical_restore(ce,includeL) -end subroutine constitutive_restore +end subroutine phase_restore !-------------------------------------------------------------------------------------------------- !> @brief Forward data after successful increment. ! ToDo: Any guessing for the current states possible? !-------------------------------------------------------------------------------------------------- -subroutine constitutive_forward() +subroutine phase_forward() integer :: ph, so - call mech_forward() + call mechanical_forward() call thermal_forward() do ph = 1, size(damageState) @@ -432,13 +432,13 @@ subroutine constitutive_forward() damageState(ph)%p(so)%state0 = damageState(ph)%p(so)%state enddo; enddo -end subroutine constitutive_forward +end subroutine phase_forward !-------------------------------------------------------------------------------------------------- !> @brief writes constitutive results to HDF5 output file !-------------------------------------------------------------------------------------------------- -subroutine constitutive_results() +subroutine phase_results() integer :: ph character(len=:), allocatable :: group @@ -451,12 +451,12 @@ subroutine constitutive_results() group = '/current/phase/'//trim(material_name_phase(ph))//'/' call results_closeGroup(results_addGroup(group)) - call mech_results(group,ph) + call mechanical_results(group,ph) call damage_results(group,ph) enddo -end subroutine constitutive_results +end subroutine phase_results !-------------------------------------------------------------------------------------------------- @@ -557,7 +557,7 @@ end subroutine crystallite_init !-------------------------------------------------------------------------------------------------- !> @brief Wind homog inc forward. !-------------------------------------------------------------------------------------------------- -subroutine constitutive_windForward(ip,el) +subroutine phase_windForward(ip,el) integer, intent(in) :: & ip, & !< integration point number @@ -572,7 +572,7 @@ subroutine constitutive_windForward(ip,el) ph = material_phaseAt(co,el) me = material_phaseMemberAt(co,ip,el) - call mech_windForward(ph,me) + call mechanical_windForward(ph,me) do so = 1, phase_Nsources(material_phaseAt(co,el)) damageState(ph)%p(so)%state0(:,me) = damageState(ph)%p(so)%state(:,me) @@ -580,7 +580,7 @@ subroutine constitutive_windForward(ip,el) enddo -end subroutine constitutive_windForward +end subroutine phase_windForward !-------------------------------------------------------------------------------------------------- @@ -595,11 +595,11 @@ subroutine crystallite_orientations(co,ip,el) call crystallite_orientation(co,ip,el)%fromMatrix(transpose(math_rotationalPart(& - mech_F_e(material_phaseAt(co,el),material_phaseMemberAt(co,ip,el))))) + mechanical_F_e(material_phaseAt(co,el),material_phaseMemberAt(co,ip,el))))) if (plasticState(material_phaseAt(1,el))%nonlocal) & call plastic_nonlocal_updateCompatibility(crystallite_orientation, & - phase_plasticityInstance(material_phaseAt(1,el)),ip,el) + phase_plasticInstance(material_phaseAt(1,el)),ip,el) end subroutine crystallite_orientations @@ -620,7 +620,7 @@ function crystallite_push33ToRef(co,ip,el, tensor33) real(pReal), dimension(3,3) :: T - T = matmul(material_orientation0(co,ip,el)%asMatrix(),transpose(math_inv33(constitutive_mech_getF(co,ip,el)))) ! ToDo: initial orientation correct? + T = matmul(material_orientation0(co,ip,el)%asMatrix(),transpose(math_inv33(phase_mechanical_getF(co,ip,el)))) ! ToDo: initial orientation correct? crystallite_push33ToRef = matmul(transpose(T),matmul(tensor33,T)) @@ -648,7 +648,7 @@ end function converged !> @brief Write current restart information (Field and constitutive data) to file. ! ToDo: Merge data into one file for MPI !-------------------------------------------------------------------------------------------------- -subroutine constitutive_restartWrite(fileHandle) +subroutine phase_restartWrite(fileHandle) integer(HID_T), intent(in) :: fileHandle @@ -662,7 +662,7 @@ subroutine constitutive_restartWrite(fileHandle) groupHandle(2) = HDF5_addGroup(groupHandle(1),material_name_phase(ph)) - call mech_restartWrite(groupHandle(2),ph) + call mechanical_restartWrite(groupHandle(2),ph) call HDF5_closeGroup(groupHandle(2)) @@ -670,14 +670,14 @@ subroutine constitutive_restartWrite(fileHandle) call HDF5_closeGroup(groupHandle(1)) -end subroutine constitutive_restartWrite +end subroutine phase_restartWrite !-------------------------------------------------------------------------------------------------- !> @brief Read data for restart ! ToDo: Merge data into one file for MPI !-------------------------------------------------------------------------------------------------- -subroutine constitutive_restartRead(fileHandle) +subroutine phase_restartRead(fileHandle) integer(HID_T), intent(in) :: fileHandle @@ -691,7 +691,7 @@ subroutine constitutive_restartRead(fileHandle) groupHandle(2) = HDF5_openGroup(groupHandle(1),material_name_phase(ph)) - call mech_restartRead(groupHandle(2),ph) + call mechanical_restartRead(groupHandle(2),ph) call HDF5_closeGroup(groupHandle(2)) @@ -699,7 +699,7 @@ subroutine constitutive_restartRead(fileHandle) call HDF5_closeGroup(groupHandle(1)) -end subroutine constitutive_restartRead +end subroutine phase_restartRead end module phase diff --git a/src/phase_damage.f90 b/src/phase_damage.f90 index 014347c1a..57145c550 100644 --- a/src/phase_damage.f90 +++ b/src/phase_damage.f90 @@ -196,7 +196,7 @@ end subroutine damage_init !---------------------------------------------------------------------------------------------- !< @brief returns local part of nonlocal damage driving force !---------------------------------------------------------------------------------------------- -module subroutine constitutive_damage_getRateAndItsTangents(phiDot, dPhiDot_dPhi, phi, ip, el) +module subroutine phase_damage_getRateAndItsTangents(phiDot, dPhiDot_dPhi, phi, ip, el) integer, intent(in) :: & ip, & !< integration point number @@ -246,7 +246,7 @@ module subroutine constitutive_damage_getRateAndItsTangents(phiDot, dPhiDot_dPhi enddo enddo -end subroutine constitutive_damage_getRateAndItsTangents +end subroutine phase_damage_getRateAndItsTangents @@ -272,9 +272,9 @@ module function integrateDamageState(dt,co,ip,el) result(broken) size_so real(pReal) :: & zeta - real(pReal), dimension(constitutive_source_maxSizeDotState) :: & + real(pReal), dimension(phase_source_maxSizeDotState) :: & r ! state residuum - real(pReal), dimension(constitutive_source_maxSizeDotState,2,maxval(phase_Nsources)) :: source_dotState + real(pReal), dimension(phase_source_maxSizeDotState,2,maxval(phase_Nsources)) :: source_dotState logical :: & converged_ @@ -283,7 +283,7 @@ module function integrateDamageState(dt,co,ip,el) result(broken) me = material_phaseMemberAt(co,ip,el) converged_ = .true. - broken = constitutive_damage_collectDotState(co,ip,el,ph,me) + broken = phase_damage_collectDotState(co,ip,el,ph,me) if(broken) return do so = 1, phase_Nsources(ph) @@ -300,7 +300,7 @@ module function integrateDamageState(dt,co,ip,el) result(broken) source_dotState(1:size_so(so),1,so) = damageState(ph)%p(so)%dotState(:,me) enddo - broken = constitutive_damage_collectDotState(co,ip,el,ph,me) + broken = phase_damage_collectDotState(co,ip,el,ph,me) if(broken) exit iteration do so = 1, phase_Nsources(ph) @@ -320,7 +320,7 @@ module function integrateDamageState(dt,co,ip,el) result(broken) enddo if(converged_) then - broken = constitutive_damage_deltaState(mech_F_e(ph,me),ph,me) + broken = phase_damage_deltaState(mechanical_F_e(ph,me),ph,me) exit iteration endif @@ -393,7 +393,7 @@ end subroutine damage_results !-------------------------------------------------------------------------------------------------- !> @brief contains the constitutive equation for calculating the rate of change of microstructure !-------------------------------------------------------------------------------------------------- -function constitutive_damage_collectDotState(co,ip,el,ph,me) result(broken) +function phase_damage_collectDotState(co,ip,el,ph,me) result(broken) integer, intent(in) :: & co, & !< component-ID me integration point @@ -419,7 +419,7 @@ function constitutive_damage_collectDotState(co,ip,el,ph,me) result(broken) call anisoductile_dotState(co, ip, el) case (DAMAGE_ANISOBRITTLE_ID) sourceType - call anisobrittle_dotState(mech_S(ph,me),co, ip, el) ! correct stress? + call anisobrittle_dotState(mechanical_S(ph,me),co, ip, el) ! correct stress? end select sourceType @@ -427,7 +427,7 @@ function constitutive_damage_collectDotState(co,ip,el,ph,me) result(broken) enddo SourceLoop -end function constitutive_damage_collectDotState +end function phase_damage_collectDotState @@ -435,7 +435,7 @@ end function constitutive_damage_collectDotState !> @brief for constitutive models having an instantaneous change of state !> will return false if delta state is not needed/supported by the constitutive model !-------------------------------------------------------------------------------------------------- -function constitutive_damage_deltaState(Fe, ph, me) result(broken) +function phase_damage_deltaState(Fe, ph, me) result(broken) integer, intent(in) :: & ph, & @@ -457,7 +457,7 @@ function constitutive_damage_deltaState(Fe, ph, me) result(broken) sourceType: select case (phase_source(so,ph)) case (DAMAGE_ISOBRITTLE_ID) sourceType - call source_damage_isoBrittle_deltaState(constitutive_homogenizedC(ph,me), Fe, ph,me) + call source_damage_isoBrittle_deltaState(phase_homogenizedC(ph,me), Fe, ph,me) broken = any(IEEE_is_NaN(damageState(ph)%p(so)%deltaState(:,me))) if(.not. broken) then myOffset = damageState(ph)%p(so)%offsetDeltaState @@ -470,7 +470,7 @@ function constitutive_damage_deltaState(Fe, ph, me) result(broken) enddo SourceLoop -end function constitutive_damage_deltaState +end function phase_damage_deltaState !-------------------------------------------------------------------------------------------------- @@ -507,7 +507,7 @@ end function source_active !---------------------------------------------------------------------------------------------- !< @brief Set damage parameter !---------------------------------------------------------------------------------------------- -module subroutine constitutive_damage_set_phi(phi,co,ce) +module subroutine phase_damage_set_phi(phi,co,ce) real(pReal), intent(in) :: phi integer, intent(in) :: ce, co @@ -515,17 +515,17 @@ module subroutine constitutive_damage_set_phi(phi,co,ce) current(material_phaseAt2(co,ce))%phi(material_phaseMemberAt2(co,ce)) = phi -end subroutine constitutive_damage_set_phi +end subroutine phase_damage_set_phi -module function constitutive_damage_get_phi(co,ip,el) result(phi) +module function phase_damage_get_phi(co,ip,el) result(phi) integer, intent(in) :: co, ip, el real(pReal) :: phi phi = current(material_phaseAt(co,el))%phi(material_phaseMemberAt(co,ip,el)) -end function constitutive_damage_get_phi +end function phase_damage_get_phi end submodule damagee diff --git a/src/phase_damage_anisobrittle.f90 b/src/phase_damage_anisobrittle.f90 index 2ae5ca951..51ca7786a 100644 --- a/src/phase_damage_anisobrittle.f90 +++ b/src/phase_damage_anisobrittle.f90 @@ -101,7 +101,7 @@ module function anisobrittle_init(source_length) result(mySources) if (any(prm%s_crit < 0.0_pReal)) extmsg = trim(extmsg)//' s_crit' Nconstituents = count(material_phaseAt==p) * discretization_nIPs - call constitutive_allocateState(damageState(p)%p(sourceOffset),Nconstituents,1,1,0) + call phase_allocateState(damageState(p)%p(sourceOffset),Nconstituents,1,1,0) damageState(p)%p(sourceOffset)%atol = src%get_asFloat('anisobrittle_atol',defaultVal=1.0e-3_pReal) if(any(damageState(p)%p(sourceOffset)%atol < 0.0_pReal)) extmsg = trim(extmsg)//' anisobrittle_atol' diff --git a/src/phase_damage_anisoductile.f90 b/src/phase_damage_anisoductile.f90 index 8d5904e6b..e54eff201 100644 --- a/src/phase_damage_anisoductile.f90 +++ b/src/phase_damage_anisoductile.f90 @@ -87,7 +87,7 @@ module function anisoductile_init(source_length) result(mySources) if (any(prm%gamma_crit < 0.0_pReal)) extmsg = trim(extmsg)//' gamma_crit' Nconstituents=count(material_phaseAt==p) * discretization_nIPs - call constitutive_allocateState(damageState(p)%p(sourceOffset),Nconstituents,1,1,0) + call phase_allocateState(damageState(p)%p(sourceOffset),Nconstituents,1,1,0) damageState(p)%p(sourceOffset)%atol = src%get_asFloat('anisoDuctile_atol',defaultVal=1.0e-3_pReal) if(any(damageState(p)%p(sourceOffset)%atol < 0.0_pReal)) extmsg = trim(extmsg)//' anisoductile_atol' diff --git a/src/phase_damage_isobrittle.f90 b/src/phase_damage_isobrittle.f90 index 091377171..529ecd404 100644 --- a/src/phase_damage_isobrittle.f90 +++ b/src/phase_damage_isobrittle.f90 @@ -74,7 +74,7 @@ module function isobrittle_init(source_length) result(mySources) if (prm%W_crit <= 0.0_pReal) extmsg = trim(extmsg)//' W_crit' Nconstituents = count(material_phaseAt==p) * discretization_nIPs - call constitutive_allocateState(damageState(p)%p(sourceOffset),Nconstituents,1,1,1) + call phase_allocateState(damageState(p)%p(sourceOffset),Nconstituents,1,1,1) damageState(p)%p(sourceOffset)%atol = src%get_asFloat('isoBrittle_atol',defaultVal=1.0e-3_pReal) if(any(damageState(p)%p(sourceOffset)%atol < 0.0_pReal)) extmsg = trim(extmsg)//' isobrittle_atol' diff --git a/src/phase_damage_isoductile.f90 b/src/phase_damage_isoductile.f90 index 6f0a2d0fb..71f99078b 100644 --- a/src/phase_damage_isoductile.f90 +++ b/src/phase_damage_isoductile.f90 @@ -78,7 +78,7 @@ module function isoductile_init(source_length) result(mySources) if (prm%gamma_crit <= 0.0_pReal) extmsg = trim(extmsg)//' gamma_crit' Nconstituents=count(material_phaseAt==p) * discretization_nIPs - call constitutive_allocateState(damageState(p)%p(sourceOffset),Nconstituents,1,1,0) + call phase_allocateState(damageState(p)%p(sourceOffset),Nconstituents,1,1,0) damageState(p)%p(sourceOffset)%atol = src%get_asFloat('isoDuctile_atol',defaultVal=1.0e-3_pReal) if(any(damageState(p)%p(sourceOffset)%atol < 0.0_pReal)) extmsg = trim(extmsg)//' isoductile_atol' diff --git a/src/phase_mechanics.f90 b/src/phase_mechanical.f90 similarity index 82% rename from src/phase_mechanics.f90 rename to src/phase_mechanical.f90 index a84c1a385..efd4d51d2 100644 --- a/src/phase_mechanics.f90 +++ b/src/phase_mechanical.f90 @@ -31,21 +31,21 @@ submodule(phase) mechanics type(tTensorContainer), dimension(:), allocatable :: & ! current value - constitutive_mech_Fe, & - constitutive_mech_Fi, & - constitutive_mech_Fp, & - constitutive_mech_F, & - constitutive_mech_Li, & - constitutive_mech_Lp, & - constitutive_mech_S, & - constitutive_mech_P, & + phase_mechanical_Fe, & + phase_mechanical_Fi, & + phase_mechanical_Fp, & + phase_mechanical_F, & + phase_mechanical_Li, & + phase_mechanical_Lp, & + phase_mechanical_S, & + phase_mechanical_P, & ! converged value at end of last solver increment - constitutive_mech_Fi0, & - constitutive_mech_Fp0, & - constitutive_mech_F0, & - constitutive_mech_Li0, & - constitutive_mech_Lp0, & - constitutive_mech_S0 + phase_mechanical_Fi0, & + phase_mechanical_Fp0, & + phase_mechanical_F0, & + phase_mechanical_Li0, & + phase_mechanical_Lp0, & + phase_mechanical_S0 integer(kind(PLASTICITY_undefined_ID)), dimension(:), allocatable :: & @@ -97,7 +97,7 @@ submodule(phase) mechanics broken end function plastic_deltaState - module subroutine constitutive_LiAndItsTangents(Li, dLi_dS, dLi_dFi, & + module subroutine phase_LiAndItsTangents(Li, dLi_dS, dLi_dFi, & S, Fi, co, ip, el) integer, intent(in) :: & @@ -114,7 +114,7 @@ submodule(phase) mechanics dLi_dS, & !< derivative of Li with respect to S dLi_dFi - end subroutine constitutive_LiAndItsTangents + end subroutine phase_LiAndItsTangents module subroutine plastic_LpAndItsTangents(Lp, dLp_dS, dLp_dFi, & @@ -186,7 +186,7 @@ contains !> @brief Initialize mechanical field related constitutive models !> @details Initialize elasticity, plasticity and stiffness degradation models. !-------------------------------------------------------------------------------------------------- -module subroutine mech_init(phases) +module subroutine mechanical_init(phases) class(tNode), pointer :: & phases @@ -215,38 +215,38 @@ module subroutine mech_init(phases) allocate(phase_NstiffnessDegradations(phases%length),source=0) allocate(output_constituent(phases%length)) - allocate(constitutive_mech_Fe(phases%length)) - allocate(constitutive_mech_Fi(phases%length)) - allocate(constitutive_mech_Fi0(phases%length)) - allocate(constitutive_mech_Fp(phases%length)) - allocate(constitutive_mech_Fp0(phases%length)) - allocate(constitutive_mech_F(phases%length)) - allocate(constitutive_mech_F0(phases%length)) - allocate(constitutive_mech_Li(phases%length)) - allocate(constitutive_mech_Li0(phases%length)) - allocate(constitutive_mech_Lp0(phases%length)) - allocate(constitutive_mech_Lp(phases%length)) - allocate(constitutive_mech_S(phases%length)) - allocate(constitutive_mech_P(phases%length)) - allocate(constitutive_mech_S0(phases%length)) + allocate(phase_mechanical_Fe(phases%length)) + allocate(phase_mechanical_Fi(phases%length)) + allocate(phase_mechanical_Fi0(phases%length)) + allocate(phase_mechanical_Fp(phases%length)) + allocate(phase_mechanical_Fp0(phases%length)) + allocate(phase_mechanical_F(phases%length)) + allocate(phase_mechanical_F0(phases%length)) + allocate(phase_mechanical_Li(phases%length)) + allocate(phase_mechanical_Li0(phases%length)) + allocate(phase_mechanical_Lp0(phases%length)) + allocate(phase_mechanical_Lp(phases%length)) + allocate(phase_mechanical_S(phases%length)) + allocate(phase_mechanical_P(phases%length)) + allocate(phase_mechanical_S0(phases%length)) do ph = 1, phases%length Nconstituents = count(material_phaseAt == ph) * discretization_nIPs - allocate(constitutive_mech_Fi(ph)%data(3,3,Nconstituents)) - allocate(constitutive_mech_Fe(ph)%data(3,3,Nconstituents)) - allocate(constitutive_mech_Fi0(ph)%data(3,3,Nconstituents)) - allocate(constitutive_mech_Fp(ph)%data(3,3,Nconstituents)) - allocate(constitutive_mech_Fp0(ph)%data(3,3,Nconstituents)) - allocate(constitutive_mech_Li(ph)%data(3,3,Nconstituents)) - allocate(constitutive_mech_Li0(ph)%data(3,3,Nconstituents)) - allocate(constitutive_mech_Lp0(ph)%data(3,3,Nconstituents)) - allocate(constitutive_mech_Lp(ph)%data(3,3,Nconstituents)) - allocate(constitutive_mech_S(ph)%data(3,3,Nconstituents),source=0.0_pReal) - allocate(constitutive_mech_P(ph)%data(3,3,Nconstituents),source=0.0_pReal) - allocate(constitutive_mech_S0(ph)%data(3,3,Nconstituents),source=0.0_pReal) - allocate(constitutive_mech_F(ph)%data(3,3,Nconstituents)) - allocate(constitutive_mech_F0(ph)%data(3,3,Nconstituents)) + allocate(phase_mechanical_Fi(ph)%data(3,3,Nconstituents)) + allocate(phase_mechanical_Fe(ph)%data(3,3,Nconstituents)) + allocate(phase_mechanical_Fi0(ph)%data(3,3,Nconstituents)) + allocate(phase_mechanical_Fp(ph)%data(3,3,Nconstituents)) + allocate(phase_mechanical_Fp0(ph)%data(3,3,Nconstituents)) + allocate(phase_mechanical_Li(ph)%data(3,3,Nconstituents)) + allocate(phase_mechanical_Li0(ph)%data(3,3,Nconstituents)) + allocate(phase_mechanical_Lp0(ph)%data(3,3,Nconstituents)) + allocate(phase_mechanical_Lp(ph)%data(3,3,Nconstituents)) + allocate(phase_mechanical_S(ph)%data(3,3,Nconstituents),source=0.0_pReal) + allocate(phase_mechanical_P(ph)%data(3,3,Nconstituents),source=0.0_pReal) + allocate(phase_mechanical_S0(ph)%data(3,3,Nconstituents),source=0.0_pReal) + allocate(phase_mechanical_F(ph)%data(3,3,Nconstituents)) + allocate(phase_mechanical_F0(ph)%data(3,3,Nconstituents)) phase => phases%get(ph) mech => phase%get('mechanics') @@ -287,17 +287,17 @@ module subroutine mech_init(phases) ph = material_phaseAt(co,el) me = material_phaseMemberAt(co,ip,el) - constitutive_mech_Fp0(ph)%data(1:3,1:3,me) = material_orientation0(co,ip,el)%asMatrix() ! Fp reflects initial orientation (see 10.1016/j.actamat.2006.01.005) - constitutive_mech_Fp0(ph)%data(1:3,1:3,me) = constitutive_mech_Fp0(ph)%data(1:3,1:3,me) & - / math_det33(constitutive_mech_Fp0(ph)%data(1:3,1:3,me))**(1.0_pReal/3.0_pReal) - constitutive_mech_Fi0(ph)%data(1:3,1:3,me) = math_I3 - constitutive_mech_F0(ph)%data(1:3,1:3,me) = math_I3 + phase_mechanical_Fp0(ph)%data(1:3,1:3,me) = material_orientation0(co,ip,el)%asMatrix() ! Fp reflects initial orientation (see 10.1016/j.actamat.2006.01.005) + phase_mechanical_Fp0(ph)%data(1:3,1:3,me) = phase_mechanical_Fp0(ph)%data(1:3,1:3,me) & + / math_det33(phase_mechanical_Fp0(ph)%data(1:3,1:3,me))**(1.0_pReal/3.0_pReal) + phase_mechanical_Fi0(ph)%data(1:3,1:3,me) = math_I3 + phase_mechanical_F0(ph)%data(1:3,1:3,me) = math_I3 - constitutive_mech_Fe(ph)%data(1:3,1:3,me) = math_inv33(matmul(constitutive_mech_Fi0(ph)%data(1:3,1:3,me), & - constitutive_mech_Fp0(ph)%data(1:3,1:3,me))) ! assuming that euler angles are given in internal strain free configuration - constitutive_mech_Fp(ph)%data(1:3,1:3,me) = constitutive_mech_Fp0(ph)%data(1:3,1:3,me) - constitutive_mech_Fi(ph)%data(1:3,1:3,me) = constitutive_mech_Fi0(ph)%data(1:3,1:3,me) - constitutive_mech_F(ph)%data(1:3,1:3,me) = constitutive_mech_F0(ph)%data(1:3,1:3,me) + phase_mechanical_Fe(ph)%data(1:3,1:3,me) = math_inv33(matmul(phase_mechanical_Fi0(ph)%data(1:3,1:3,me), & + phase_mechanical_Fp0(ph)%data(1:3,1:3,me))) ! assuming that euler angles are given in internal strain free configuration + phase_mechanical_Fp(ph)%data(1:3,1:3,me) = phase_mechanical_Fp0(ph)%data(1:3,1:3,me) + phase_mechanical_Fi(ph)%data(1:3,1:3,me) = phase_mechanical_Fi0(ph)%data(1:3,1:3,me) + phase_mechanical_F(ph)%data(1:3,1:3,me) = phase_mechanical_F0(ph)%data(1:3,1:3,me) enddo enddo; enddo @@ -307,14 +307,14 @@ module subroutine mech_init(phases) ! initialize plasticity allocate(plasticState(phases%length)) allocate(phase_plasticity(phases%length),source = PLASTICITY_undefined_ID) - allocate(phase_plasticityInstance(phases%length),source = 0) + allocate(phase_plasticInstance(phases%length),source = 0) allocate(phase_localPlasticity(phases%length), source=.true.) call plastic_init() do ph = 1, phases%length phase_elasticityInstance(ph) = count(phase_elasticity(1:ph) == phase_elasticity(ph)) - phase_plasticityInstance(ph) = count(phase_plasticity(1:ph) == phase_plasticity(ph)) + phase_plasticInstance(ph) = count(phase_plasticity(1:ph) == phase_plasticity(ph)) enddo num_crystallite => config_numerics%get('crystallite',defaultVal=emptyDict) @@ -345,14 +345,14 @@ module subroutine mech_init(phases) call eigendeformation_init(phases) -end subroutine mech_init +end subroutine mechanical_init !-------------------------------------------------------------------------------------------------- !> @brief returns the 2nd Piola-Kirchhoff stress tensor and its tangent with respect to !> the elastic and intermediate deformation gradients using Hooke's law !-------------------------------------------------------------------------------------------------- -subroutine constitutive_hooke_SandItsTangents(S, dS_dFe, dS_dFi, & +subroutine phase_hooke_SandItsTangents(S, dS_dFe, dS_dFi, & Fe, Fi, co, ip, el) integer, intent(in) :: & @@ -376,7 +376,7 @@ subroutine constitutive_hooke_SandItsTangents(S, dS_dFe, dS_dFi, & i, j, ph, me ho = material_homogenizationAt(el) - C = math_66toSym3333(constitutive_homogenizedC(material_phaseAt(co,el),material_phaseMemberAt(co,ip,el))) + C = math_66toSym3333(phase_homogenizedC(material_phaseAt(co,el),material_phaseMemberAt(co,ip,el))) DegradationLoop: do d = 1, phase_NstiffnessDegradations(material_phaseAt(co,el)) degradationType: select case(phase_stiffnessDegradation(d,material_phaseAt(co,el))) @@ -393,10 +393,10 @@ subroutine constitutive_hooke_SandItsTangents(S, dS_dFe, dS_dFi, & dS_dFi(i,j,1:3,1:3) = 2.0_pReal*matmul(matmul(E,Fi),C(i,j,1:3,1:3)) !< dS_ij/dFi_kl = C_ijln * E_km * Fe_mn enddo; enddo -end subroutine constitutive_hooke_SandItsTangents +end subroutine phase_hooke_SandItsTangents -module subroutine mech_results(group,ph) +module subroutine mechanical_results(group,ph) character(len=*), intent(in) :: group integer, intent(in) :: ph @@ -407,28 +407,28 @@ module subroutine mech_results(group,ph) select case(phase_plasticity(ph)) case(PLASTICITY_ISOTROPIC_ID) - call plastic_isotropic_results(phase_plasticityInstance(ph),group//'plastic/') + call plastic_isotropic_results(phase_plasticInstance(ph),group//'plastic/') case(PLASTICITY_PHENOPOWERLAW_ID) - call plastic_phenopowerlaw_results(phase_plasticityInstance(ph),group//'plastic/') + call plastic_phenopowerlaw_results(phase_plasticInstance(ph),group//'plastic/') case(PLASTICITY_KINEHARDENING_ID) - call plastic_kinehardening_results(phase_plasticityInstance(ph),group//'plastic/') + call plastic_kinehardening_results(phase_plasticInstance(ph),group//'plastic/') case(PLASTICITY_DISLOTWIN_ID) - call plastic_dislotwin_results(phase_plasticityInstance(ph),group//'plastic/') + call plastic_dislotwin_results(phase_plasticInstance(ph),group//'plastic/') case(PLASTICITY_DISLOTUNGSTEN_ID) - call plastic_dislotungsten_results(phase_plasticityInstance(ph),group//'plastic/') + call plastic_dislotungsten_results(phase_plasticInstance(ph),group//'plastic/') case(PLASTICITY_NONLOCAL_ID) - call plastic_nonlocal_results(phase_plasticityInstance(ph),group//'plastic/') + call plastic_nonlocal_results(phase_plasticInstance(ph),group//'plastic/') end select call crystallite_results(group,ph) -end subroutine mech_results +end subroutine mechanical_results !-------------------------------------------------------------------------------------------------- @@ -503,8 +503,8 @@ function integrateStress(F,subFp0,subFi0,Delta_t,co,ip,el) result(broken) call plastic_dependentState(co,ip,el) - Lpguess = constitutive_mech_Lp(ph)%data(1:3,1:3,me) ! take as first guess - Liguess = constitutive_mech_Li(ph)%data(1:3,1:3,me) ! take as first guess + Lpguess = phase_mechanical_Lp(ph)%data(1:3,1:3,me) ! take as first guess + Liguess = phase_mechanical_Li(ph)%data(1:3,1:3,me) ! take as first guess call math_invert33(invFp_current,devNull,error,subFp0) if (error) return ! error @@ -538,7 +538,7 @@ function integrateStress(F,subFp0,subFi0,Delta_t,co,ip,el) result(broken) B = math_I3 - Delta_t*Lpguess Fe = matmul(matmul(A,B), invFi_new) - call constitutive_hooke_SandItsTangents(S, dS_dFe, dS_dFi, & + call phase_hooke_SandItsTangents(S, dS_dFe, dS_dFi, & Fe, Fi_new, co, ip, el) call plastic_LpAndItsTangents(Lp_constitutive, dLp_dS, dLp_dFi, & @@ -582,7 +582,7 @@ function integrateStress(F,subFp0,subFi0,Delta_t,co,ip,el) result(broken) + deltaLp * steplengthLp enddo LpLoop - call constitutive_LiAndItsTangents(Li_constitutive, dLi_dS, dLi_dFi, & + call phase_LiAndItsTangents(Li_constitutive, dLi_dS, dLi_dFi, & S, Fi_new, co, ip, el) !* update current residuum and check for convergence of loop @@ -633,13 +633,13 @@ function integrateStress(F,subFp0,subFi0,Delta_t,co,ip,el) result(broken) call math_invert33(Fp_new,devNull,error,invFp_new) if (error) return ! error - constitutive_mech_P(ph)%data(1:3,1:3,me) = matmul(matmul(F,invFp_new),matmul(S,transpose(invFp_new))) - constitutive_mech_S(ph)%data(1:3,1:3,me) = S - constitutive_mech_Lp(ph)%data(1:3,1:3,me) = Lpguess - constitutive_mech_Li(ph)%data(1:3,1:3,me) = Liguess - constitutive_mech_Fp(ph)%data(1:3,1:3,me) = Fp_new / math_det33(Fp_new)**(1.0_pReal/3.0_pReal) ! regularize - constitutive_mech_Fi(ph)%data(1:3,1:3,me) = Fi_new - constitutive_mech_Fe(ph)%data(1:3,1:3,me) = matmul(matmul(F,invFp_new),invFi_new) + phase_mechanical_P(ph)%data(1:3,1:3,me) = matmul(matmul(F,invFp_new),matmul(S,transpose(invFp_new))) + phase_mechanical_S(ph)%data(1:3,1:3,me) = S + phase_mechanical_Lp(ph)%data(1:3,1:3,me) = Lpguess + phase_mechanical_Li(ph)%data(1:3,1:3,me) = Liguess + phase_mechanical_Fp(ph)%data(1:3,1:3,me) = Fp_new / math_det33(Fp_new)**(1.0_pReal/3.0_pReal) ! regularize + phase_mechanical_Fi(ph)%data(1:3,1:3,me) = Fi_new + phase_mechanical_Fe(ph)%data(1:3,1:3,me) = matmul(matmul(F,invFp_new),invFi_new) broken = .false. end function integrateStress @@ -668,9 +668,9 @@ function integrateStateFPI(F_0,F,subFp0,subFi0,subState0,Delta_t,co,ip,el) resul sizeDotState real(pReal) :: & zeta - real(pReal), dimension(constitutive_plasticity_maxSizeDotState) :: & + real(pReal), dimension(phase_plasticity_maxSizeDotState) :: & r ! state residuum - real(pReal), dimension(constitutive_plasticity_maxSizeDotState,2) :: & + real(pReal), dimension(phase_plasticity_maxSizeDotState,2) :: & dotState @@ -796,7 +796,7 @@ function integrateStateAdaptiveEuler(F_0,F,subFp0,subFi0,subState0,Delta_t,co,ip ph, & me, & sizeDotState - real(pReal), dimension(constitutive_plasticity_maxSizeDotState) :: residuum_plastic + real(pReal), dimension(phase_plasticity_maxSizeDotState) :: residuum_plastic ph = material_phaseAt(co,el) @@ -914,7 +914,7 @@ function integrateStateRK(F_0,F,subFp0,subFi0,subState0,Delta_t,co,ip,el,A,B,C,D ph, & me, & sizeDotState - real(pReal), dimension(constitutive_plasticity_maxSizeDotState,size(B)) :: plastic_RKdotState + real(pReal), dimension(phase_plasticity_maxSizeDotState,size(B)) :: plastic_RKdotState ph = material_phaseAt(co,el) @@ -987,28 +987,28 @@ subroutine crystallite_results(group,ph) select case (output_constituent(ph)%label(ou)) case('F') - call results_writeDataset(group//'/mechanics/',constitutive_mech_F(ph)%data,'F',& + call results_writeDataset(group//'/mechanics/',phase_mechanical_F(ph)%data,'F',& 'deformation gradient','1') case('F_e') - call results_writeDataset(group//'/mechanics/',constitutive_mech_Fe(ph)%data,'F_e',& + call results_writeDataset(group//'/mechanics/',phase_mechanical_Fe(ph)%data,'F_e',& 'elastic deformation gradient','1') case('F_p') - call results_writeDataset(group//'/mechanics/',constitutive_mech_Fp(ph)%data,'F_p', & + call results_writeDataset(group//'/mechanics/',phase_mechanical_Fp(ph)%data,'F_p', & 'plastic deformation gradient','1') case('F_i') - call results_writeDataset(group//'/mechanics/',constitutive_mech_Fi(ph)%data,'F_i', & + call results_writeDataset(group//'/mechanics/',phase_mechanical_Fi(ph)%data,'F_i', & 'inelastic deformation gradient','1') case('L_p') - call results_writeDataset(group//'/mechanics/',constitutive_mech_Lp(ph)%data,'L_p', & + call results_writeDataset(group//'/mechanics/',phase_mechanical_Lp(ph)%data,'L_p', & 'plastic velocity gradient','1/s') case('L_i') - call results_writeDataset(group//'/mechanics/',constitutive_mech_Li(ph)%data,'L_i', & + call results_writeDataset(group//'/mechanics/',phase_mechanical_Li(ph)%data,'L_i', & 'inelastic velocity gradient','1/s') case('P') - call results_writeDataset(group//'/mechanics/',constitutive_mech_P(ph)%data,'P', & + call results_writeDataset(group//'/mechanics/',phase_mechanical_P(ph)%data,'P', & 'First Piola-Kirchhoff stress','Pa') case('S') - call results_writeDataset(group//'/mechanics/',constitutive_mech_S(ph)%data,'S', & + call results_writeDataset(group//'/mechanics/',phase_mechanical_S(ph)%data,'S', & 'Second Piola-Kirchhoff stress','Pa') case('O') select case(lattice_structure(ph)) @@ -1067,43 +1067,43 @@ end subroutine crystallite_results !-------------------------------------------------------------------------------------------------- !> @brief Wind homog inc forward. !-------------------------------------------------------------------------------------------------- -module subroutine mech_windForward(ph,me) +module subroutine mechanical_windForward(ph,me) integer, intent(in) :: ph, me - constitutive_mech_Fp0(ph)%data(1:3,1:3,me) = constitutive_mech_Fp(ph)%data(1:3,1:3,me) - constitutive_mech_Fi0(ph)%data(1:3,1:3,me) = constitutive_mech_Fi(ph)%data(1:3,1:3,me) - constitutive_mech_F0(ph)%data(1:3,1:3,me) = constitutive_mech_F(ph)%data(1:3,1:3,me) - constitutive_mech_Li0(ph)%data(1:3,1:3,me) = constitutive_mech_Li(ph)%data(1:3,1:3,me) - constitutive_mech_Lp0(ph)%data(1:3,1:3,me) = constitutive_mech_Lp(ph)%data(1:3,1:3,me) - constitutive_mech_S0(ph)%data(1:3,1:3,me) = constitutive_mech_S(ph)%data(1:3,1:3,me) + phase_mechanical_Fp0(ph)%data(1:3,1:3,me) = phase_mechanical_Fp(ph)%data(1:3,1:3,me) + phase_mechanical_Fi0(ph)%data(1:3,1:3,me) = phase_mechanical_Fi(ph)%data(1:3,1:3,me) + phase_mechanical_F0(ph)%data(1:3,1:3,me) = phase_mechanical_F(ph)%data(1:3,1:3,me) + phase_mechanical_Li0(ph)%data(1:3,1:3,me) = phase_mechanical_Li(ph)%data(1:3,1:3,me) + phase_mechanical_Lp0(ph)%data(1:3,1:3,me) = phase_mechanical_Lp(ph)%data(1:3,1:3,me) + phase_mechanical_S0(ph)%data(1:3,1:3,me) = phase_mechanical_S(ph)%data(1:3,1:3,me) plasticState(ph)%State0(:,me) = plasticState(ph)%state(:,me) -end subroutine mech_windForward +end subroutine mechanical_windForward !-------------------------------------------------------------------------------------------------- !> @brief Forward data after successful increment. ! ToDo: Any guessing for the current states possible? !-------------------------------------------------------------------------------------------------- -module subroutine mech_forward() +module subroutine mechanical_forward() integer :: ph do ph = 1, size(plasticState) - constitutive_mech_Fi0(ph) = constitutive_mech_Fi(ph) - constitutive_mech_Fp0(ph) = constitutive_mech_Fp(ph) - constitutive_mech_F0(ph) = constitutive_mech_F(ph) - constitutive_mech_Li0(ph) = constitutive_mech_Li(ph) - constitutive_mech_Lp0(ph) = constitutive_mech_Lp(ph) - constitutive_mech_S0(ph) = constitutive_mech_S(ph) + phase_mechanical_Fi0(ph) = phase_mechanical_Fi(ph) + phase_mechanical_Fp0(ph) = phase_mechanical_Fp(ph) + phase_mechanical_F0(ph) = phase_mechanical_F(ph) + phase_mechanical_Li0(ph) = phase_mechanical_Li(ph) + phase_mechanical_Lp0(ph) = phase_mechanical_Lp(ph) + phase_mechanical_S0(ph) = phase_mechanical_S(ph) plasticState(ph)%state0 = plasticState(ph)%state enddo -end subroutine mech_forward +end subroutine mechanical_forward @@ -1111,19 +1111,19 @@ end subroutine mech_forward !> @brief returns the homogenize elasticity matrix !> ToDo: homogenizedC66 would be more consistent !-------------------------------------------------------------------------------------------------- -module function constitutive_homogenizedC(ph,me) result(C) +module function phase_homogenizedC(ph,me) result(C) real(pReal), dimension(6,6) :: C integer, intent(in) :: ph, me - plasticityType: select case (phase_plasticity(ph)) - case (PLASTICITY_DISLOTWIN_ID) plasticityType + plasticType: select case (phase_plasticity(ph)) + case (PLASTICITY_DISLOTWIN_ID) plasticType C = plastic_dislotwin_homogenizedC(ph,me) - case default plasticityType + case default plasticType C = lattice_C66(1:6,1:6,ph) - end select plasticityType + end select plasticType -end function constitutive_homogenizedC +end function phase_homogenizedC !-------------------------------------------------------------------------------------------------- @@ -1158,17 +1158,17 @@ module function crystallite_stress(dt,co,ip,el) result(converged_) me = material_phaseMemberAt(co,ip,el) sizeDotState = plasticState(ph)%sizeDotState - subLi0 = constitutive_mech_Li0(ph)%data(1:3,1:3,me) - subLp0 = constitutive_mech_Lp0(ph)%data(1:3,1:3,me) + subLi0 = phase_mechanical_Li0(ph)%data(1:3,1:3,me) + subLp0 = phase_mechanical_Lp0(ph)%data(1:3,1:3,me) subState0 = plasticState(ph)%State0(:,me) do so = 1, phase_Nsources(ph) damageState(ph)%p(so)%subState0(:,me) = damageState(ph)%p(so)%state0(:,me) enddo - subFp0 = constitutive_mech_Fp0(ph)%data(1:3,1:3,me) - subFi0 = constitutive_mech_Fi0(ph)%data(1:3,1:3,me) - subF0 = constitutive_mech_F0(ph)%data(1:3,1:3,me) + subFp0 = phase_mechanical_Fp0(ph)%data(1:3,1:3,me) + subFi0 = phase_mechanical_Fi0(ph)%data(1:3,1:3,me) + subF0 = phase_mechanical_F0(ph)%data(1:3,1:3,me) subFrac = 0.0_pReal subStep = 1.0_pReal/num%subStepSizeCryst todo = .true. @@ -1186,10 +1186,10 @@ module function crystallite_stress(dt,co,ip,el) result(converged_) if (todo) then subF0 = subF - subLp0 = constitutive_mech_Lp(ph)%data(1:3,1:3,me) - subLi0 = constitutive_mech_Li(ph)%data(1:3,1:3,me) - subFp0 = constitutive_mech_Fp(ph)%data(1:3,1:3,me) - subFi0 = constitutive_mech_Fi(ph)%data(1:3,1:3,me) + subLp0 = phase_mechanical_Lp(ph)%data(1:3,1:3,me) + subLi0 = phase_mechanical_Li(ph)%data(1:3,1:3,me) + subFp0 = phase_mechanical_Fp(ph)%data(1:3,1:3,me) + subFi0 = phase_mechanical_Fi(ph)%data(1:3,1:3,me) subState0 = plasticState(ph)%state(:,me) do so = 1, phase_Nsources(ph) damageState(ph)%p(so)%subState0(:,me) = damageState(ph)%p(so)%state(:,me) @@ -1199,12 +1199,12 @@ module function crystallite_stress(dt,co,ip,el) result(converged_) ! cut back (reduced time and restore) else subStep = num%subStepSizeCryst * subStep - constitutive_mech_Fp(ph)%data(1:3,1:3,me) = subFp0 - constitutive_mech_Fi(ph)%data(1:3,1:3,me) = subFi0 - constitutive_mech_S(ph)%data(1:3,1:3,me) = constitutive_mech_S0(ph)%data(1:3,1:3,me) ! why no subS0 ? is S0 of any use? + phase_mechanical_Fp(ph)%data(1:3,1:3,me) = subFp0 + phase_mechanical_Fi(ph)%data(1:3,1:3,me) = subFi0 + phase_mechanical_S(ph)%data(1:3,1:3,me) = phase_mechanical_S0(ph)%data(1:3,1:3,me) ! why no subS0 ? is S0 of any use? if (subStep < 1.0_pReal) then ! actual (not initial) cutback - constitutive_mech_Lp(ph)%data(1:3,1:3,me) = subLp0 - constitutive_mech_Li(ph)%data(1:3,1:3,me) = subLi0 + phase_mechanical_Lp(ph)%data(1:3,1:3,me) = subLp0 + phase_mechanical_Li(ph)%data(1:3,1:3,me) = subLi0 endif plasticState(ph)%state(:,me) = subState0 do so = 1, phase_Nsources(ph) @@ -1218,9 +1218,9 @@ module function crystallite_stress(dt,co,ip,el) result(converged_) ! prepare for integration if (todo) then subF = subF0 & - + subStep * (constitutive_mech_F(ph)%data(1:3,1:3,me) - constitutive_mech_F0(ph)%data(1:3,1:3,me)) - constitutive_mech_Fe(ph)%data(1:3,1:3,me) = matmul(subF,math_inv33(matmul(constitutive_mech_Fi(ph)%data(1:3,1:3,me), & - constitutive_mech_Fp(ph)%data(1:3,1:3,me)))) + + subStep * (phase_mechanical_F(ph)%data(1:3,1:3,me) - phase_mechanical_F0(ph)%data(1:3,1:3,me)) + phase_mechanical_Fe(ph)%data(1:3,1:3,me) = matmul(subF,math_inv33(matmul(phase_mechanical_Fi(ph)%data(1:3,1:3,me), & + phase_mechanical_Fp(ph)%data(1:3,1:3,me)))) converged_ = .not. integrateState(subF0,subF,subFp0,subFi0,subState0(1:sizeDotState),subStep * dt,co,ip,el) converged_ = converged_ .and. .not. integrateDamageState(subStep * dt,co,ip,el) endif @@ -1233,7 +1233,7 @@ end function crystallite_stress !-------------------------------------------------------------------------------------------------- !> @brief Restore data after homog cutback. !-------------------------------------------------------------------------------------------------- -module subroutine mech_restore(ce,includeL) +module subroutine mechanical_restore(ce,includeL) integer, intent(in) :: ce logical, intent(in) :: & @@ -1247,23 +1247,23 @@ module subroutine mech_restore(ce,includeL) ph = material_phaseAt2(co,ce) me = material_phaseMemberAt2(co,ce) if (includeL) then - constitutive_mech_Lp(ph)%data(1:3,1:3,me) = constitutive_mech_Lp0(ph)%data(1:3,1:3,me) - constitutive_mech_Li(ph)%data(1:3,1:3,me) = constitutive_mech_Li0(ph)%data(1:3,1:3,me) + phase_mechanical_Lp(ph)%data(1:3,1:3,me) = phase_mechanical_Lp0(ph)%data(1:3,1:3,me) + phase_mechanical_Li(ph)%data(1:3,1:3,me) = phase_mechanical_Li0(ph)%data(1:3,1:3,me) endif ! maybe protecting everything from overwriting makes more sense - constitutive_mech_Fp(ph)%data(1:3,1:3,me) = constitutive_mech_Fp0(ph)%data(1:3,1:3,me) - constitutive_mech_Fi(ph)%data(1:3,1:3,me) = constitutive_mech_Fi0(ph)%data(1:3,1:3,me) - constitutive_mech_S(ph)%data(1:3,1:3,me) = constitutive_mech_S0(ph)%data(1:3,1:3,me) + phase_mechanical_Fp(ph)%data(1:3,1:3,me) = phase_mechanical_Fp0(ph)%data(1:3,1:3,me) + phase_mechanical_Fi(ph)%data(1:3,1:3,me) = phase_mechanical_Fi0(ph)%data(1:3,1:3,me) + phase_mechanical_S(ph)%data(1:3,1:3,me) = phase_mechanical_S0(ph)%data(1:3,1:3,me) plasticState(ph)%state(:,me) = plasticState(ph)%State0(:,me) enddo -end subroutine mech_restore +end subroutine mechanical_restore !-------------------------------------------------------------------------------------------------- !> @brief Calculate tangent (dPdF). !-------------------------------------------------------------------------------------------------- -module function constitutive_mech_dPdF(dt,co,ip,el) result(dPdF) +module function phase_mechanical_dPdF(dt,co,ip,el) result(dPdF) real(pReal), intent(in) :: dt integer, intent(in) :: & @@ -1297,18 +1297,18 @@ module function constitutive_mech_dPdF(dt,co,ip,el) result(dPdF) ph = material_phaseAt(co,el) me = material_phaseMemberAt(co,ip,el) - call constitutive_hooke_SandItsTangents(devNull,dSdFe,dSdFi, & - constitutive_mech_Fe(ph)%data(1:3,1:3,me), & - constitutive_mech_Fi(ph)%data(1:3,1:3,me),co,ip,el) - call constitutive_LiAndItsTangents(devNull,dLidS,dLidFi, & - constitutive_mech_S(ph)%data(1:3,1:3,me), & - constitutive_mech_Fi(ph)%data(1:3,1:3,me), & + call phase_hooke_SandItsTangents(devNull,dSdFe,dSdFi, & + phase_mechanical_Fe(ph)%data(1:3,1:3,me), & + phase_mechanical_Fi(ph)%data(1:3,1:3,me),co,ip,el) + call phase_LiAndItsTangents(devNull,dLidS,dLidFi, & + phase_mechanical_S(ph)%data(1:3,1:3,me), & + phase_mechanical_Fi(ph)%data(1:3,1:3,me), & co,ip,el) - invFp = math_inv33(constitutive_mech_Fp(ph)%data(1:3,1:3,me)) - invFi = math_inv33(constitutive_mech_Fi(ph)%data(1:3,1:3,me)) - invSubFp0 = math_inv33(constitutive_mech_Fp0(ph)%data(1:3,1:3,me)) - invSubFi0 = math_inv33(constitutive_mech_Fi0(ph)%data(1:3,1:3,me)) + invFp = math_inv33(phase_mechanical_Fp(ph)%data(1:3,1:3,me)) + invFi = math_inv33(phase_mechanical_Fi(ph)%data(1:3,1:3,me)) + invSubFp0 = math_inv33(phase_mechanical_Fp0(ph)%data(1:3,1:3,me)) + invSubFi0 = math_inv33(phase_mechanical_Fi0(ph)%data(1:3,1:3,me)) if (sum(abs(dLidS)) < tol_math_check) then dFidS = 0.0_pReal @@ -1334,15 +1334,15 @@ module function constitutive_mech_dPdF(dt,co,ip,el) result(dPdF) endif call plastic_LpAndItsTangents(devNull,dLpdS,dLpdFi, & - constitutive_mech_S(ph)%data(1:3,1:3,me), & - constitutive_mech_Fi(ph)%data(1:3,1:3,me),co,ip,el) + phase_mechanical_S(ph)%data(1:3,1:3,me), & + phase_mechanical_Fi(ph)%data(1:3,1:3,me),co,ip,el) dLpdS = math_mul3333xx3333(dLpdFi,dFidS) + dLpdS !-------------------------------------------------------------------------------------------------- ! calculate dSdF temp_33_1 = transpose(matmul(invFp,invFi)) - temp_33_2 = matmul(constitutive_mech_F(ph)%data(1:3,1:3,me),invSubFp0) - temp_33_3 = matmul(matmul(constitutive_mech_F(ph)%data(1:3,1:3,me),invFp), invSubFi0) + temp_33_2 = matmul(phase_mechanical_F(ph)%data(1:3,1:3,me),invSubFp0) + temp_33_3 = matmul(matmul(phase_mechanical_F(ph)%data(1:3,1:3,me),invFp), invSubFi0) do o=1,3; do p=1,3 rhs_3333(p,o,1:3,1:3) = matmul(dSdFe(p,o,1:3,1:3),temp_33_1) @@ -1370,9 +1370,9 @@ module function constitutive_mech_dPdF(dt,co,ip,el) result(dPdF) !-------------------------------------------------------------------------------------------------- ! assemble dPdF - temp_33_1 = matmul(constitutive_mech_S(ph)%data(1:3,1:3,me),transpose(invFp)) - temp_33_2 = matmul(constitutive_mech_F(ph)%data(1:3,1:3,me),invFp) - temp_33_3 = matmul(temp_33_2,constitutive_mech_S(ph)%data(1:3,1:3,me)) + temp_33_1 = matmul(phase_mechanical_S(ph)%data(1:3,1:3,me),transpose(invFp)) + temp_33_2 = matmul(phase_mechanical_F(ph)%data(1:3,1:3,me),invFp) + temp_33_3 = matmul(temp_33_2,phase_mechanical_S(ph)%data(1:3,1:3,me)) dPdF = 0.0_pReal do p=1,3 @@ -1380,129 +1380,129 @@ module function constitutive_mech_dPdF(dt,co,ip,el) result(dPdF) enddo do o=1,3; do p=1,3 dPdF(1:3,1:3,p,o) = dPdF(1:3,1:3,p,o) & - + matmul(matmul(constitutive_mech_F(ph)%data(1:3,1:3,me),dFpinvdF(1:3,1:3,p,o)),temp_33_1) & + + matmul(matmul(phase_mechanical_F(ph)%data(1:3,1:3,me),dFpinvdF(1:3,1:3,p,o)),temp_33_1) & + matmul(matmul(temp_33_2,dSdF(1:3,1:3,p,o)),transpose(invFp)) & + matmul(temp_33_3,transpose(dFpinvdF(1:3,1:3,p,o))) enddo; enddo -end function constitutive_mech_dPdF +end function phase_mechanical_dPdF -module subroutine mech_restartWrite(groupHandle,ph) +module subroutine mechanical_restartWrite(groupHandle,ph) integer(HID_T), intent(in) :: groupHandle integer, intent(in) :: ph call HDF5_write(groupHandle,plasticState(ph)%state,'omega') - call HDF5_write(groupHandle,constitutive_mech_Fi(ph)%data,'F_i') - call HDF5_write(groupHandle,constitutive_mech_Li(ph)%data,'L_i') - call HDF5_write(groupHandle,constitutive_mech_Lp(ph)%data,'L_p') - call HDF5_write(groupHandle,constitutive_mech_Fp(ph)%data,'F_p') - call HDF5_write(groupHandle,constitutive_mech_S(ph)%data,'S') - call HDF5_write(groupHandle,constitutive_mech_F(ph)%data,'F') + call HDF5_write(groupHandle,phase_mechanical_Fi(ph)%data,'F_i') + call HDF5_write(groupHandle,phase_mechanical_Li(ph)%data,'L_i') + call HDF5_write(groupHandle,phase_mechanical_Lp(ph)%data,'L_p') + call HDF5_write(groupHandle,phase_mechanical_Fp(ph)%data,'F_p') + call HDF5_write(groupHandle,phase_mechanical_S(ph)%data,'S') + call HDF5_write(groupHandle,phase_mechanical_F(ph)%data,'F') -end subroutine mech_restartWrite +end subroutine mechanical_restartWrite -module subroutine mech_restartRead(groupHandle,ph) +module subroutine mechanical_restartRead(groupHandle,ph) integer(HID_T), intent(in) :: groupHandle integer, intent(in) :: ph call HDF5_read(groupHandle,plasticState(ph)%state0,'omega') - call HDF5_read(groupHandle,constitutive_mech_Fi0(ph)%data,'F_i') - call HDF5_read(groupHandle,constitutive_mech_Li0(ph)%data,'L_i') - call HDF5_read(groupHandle,constitutive_mech_Lp0(ph)%data,'L_p') - call HDF5_read(groupHandle,constitutive_mech_Fp0(ph)%data,'F_p') - call HDF5_read(groupHandle,constitutive_mech_S0(ph)%data,'S') - call HDF5_read(groupHandle,constitutive_mech_F0(ph)%data,'F') + call HDF5_read(groupHandle,phase_mechanical_Fi0(ph)%data,'F_i') + call HDF5_read(groupHandle,phase_mechanical_Li0(ph)%data,'L_i') + call HDF5_read(groupHandle,phase_mechanical_Lp0(ph)%data,'L_p') + call HDF5_read(groupHandle,phase_mechanical_Fp0(ph)%data,'F_p') + call HDF5_read(groupHandle,phase_mechanical_S0(ph)%data,'S') + call HDF5_read(groupHandle,phase_mechanical_F0(ph)%data,'F') -end subroutine mech_restartRead +end subroutine mechanical_restartRead !---------------------------------------------------------------------------------------------- !< @brief Get first Piola-Kichhoff stress (for use by non-mech physics) !---------------------------------------------------------------------------------------------- -module function mech_S(ph,me) result(S) +module function mechanical_S(ph,me) result(S) integer, intent(in) :: ph,me real(pReal), dimension(3,3) :: S - S = constitutive_mech_S(ph)%data(1:3,1:3,me) + S = phase_mechanical_S(ph)%data(1:3,1:3,me) -end function mech_S +end function mechanical_S !---------------------------------------------------------------------------------------------- !< @brief Get plastic velocity gradient (for use by non-mech physics) !---------------------------------------------------------------------------------------------- -module function mech_L_p(ph,me) result(L_p) +module function mechanical_L_p(ph,me) result(L_p) integer, intent(in) :: ph,me real(pReal), dimension(3,3) :: L_p - L_p = constitutive_mech_Lp(ph)%data(1:3,1:3,me) + L_p = phase_mechanical_Lp(ph)%data(1:3,1:3,me) -end function mech_L_p +end function mechanical_L_p !---------------------------------------------------------------------------------------------- !< @brief Get deformation gradient (for use by homogenization) !---------------------------------------------------------------------------------------------- -module function constitutive_mech_getF(co,ip,el) result(F) +module function phase_mechanical_getF(co,ip,el) result(F) integer, intent(in) :: co, ip, el real(pReal), dimension(3,3) :: F - F = constitutive_mech_F(material_phaseAt(co,el))%data(1:3,1:3,material_phaseMemberAt(co,ip,el)) + F = phase_mechanical_F(material_phaseAt(co,el))%data(1:3,1:3,material_phaseMemberAt(co,ip,el)) -end function constitutive_mech_getF +end function phase_mechanical_getF !---------------------------------------------------------------------------------------------- !< @brief Get elastic deformation gradient (for use by non-mech physics) !---------------------------------------------------------------------------------------------- -module function mech_F_e(ph,me) result(F_e) +module function mechanical_F_e(ph,me) result(F_e) integer, intent(in) :: ph,me real(pReal), dimension(3,3) :: F_e - F_e = constitutive_mech_Fe(ph)%data(1:3,1:3,me) + F_e = phase_mechanical_Fe(ph)%data(1:3,1:3,me) -end function mech_F_e +end function mechanical_F_e !---------------------------------------------------------------------------------------------- !< @brief Get second Piola-Kichhoff stress (for use by homogenization) !---------------------------------------------------------------------------------------------- -module function constitutive_mech_getP(co,ip,el) result(P) +module function phase_mechanical_getP(co,ip,el) result(P) integer, intent(in) :: co, ip, el real(pReal), dimension(3,3) :: P - P = constitutive_mech_P(material_phaseAt(co,el))%data(1:3,1:3,material_phaseMemberAt(co,ip,el)) + P = phase_mechanical_P(material_phaseAt(co,el))%data(1:3,1:3,material_phaseMemberAt(co,ip,el)) -end function constitutive_mech_getP +end function phase_mechanical_getP ! setter for homogenization -module subroutine constitutive_mech_setF(F,co,ip,el) +module subroutine phase_mechanical_setF(F,co,ip,el) real(pReal), dimension(3,3), intent(in) :: F integer, intent(in) :: co, ip, el - constitutive_mech_F(material_phaseAt(co,el))%data(1:3,1:3,material_phaseMemberAt(co,ip,el)) = F + phase_mechanical_F(material_phaseAt(co,el))%data(1:3,1:3,material_phaseMemberAt(co,ip,el)) = F -end subroutine constitutive_mech_setF +end subroutine phase_mechanical_setF end submodule mechanics diff --git a/src/phase_mechanics_eigendeformation.f90 b/src/phase_mechanical_eigen.f90 similarity index 96% rename from src/phase_mechanics_eigendeformation.f90 rename to src/phase_mechanical_eigen.f90 index 45cfd82d3..6df993565 100644 --- a/src/phase_mechanics_eigendeformation.f90 +++ b/src/phase_mechanical_eigen.f90 @@ -126,7 +126,7 @@ end function kinematics_active !> @brief contains the constitutive equation for calculating the velocity gradient ! ToDo: MD: S is Mi? !-------------------------------------------------------------------------------------------------- -module subroutine constitutive_LiAndItsTangents(Li, dLi_dS, dLi_dFi, & +module subroutine phase_LiAndItsTangents(Li, dLi_dS, dLi_dFi, & S, Fi, co, ip, el) integer, intent(in) :: & @@ -159,15 +159,15 @@ module subroutine constitutive_LiAndItsTangents(Li, dLi_dS, dLi_dFi, & dLi_dS = 0.0_pReal dLi_dFi = 0.0_pReal - plasticityType: select case (phase_plasticity(material_phaseAt(co,el))) - case (PLASTICITY_isotropic_ID) plasticityType + plasticType: select case (phase_plasticity(material_phaseAt(co,el))) + case (PLASTICITY_isotropic_ID) plasticType of = material_phasememberAt(co,ip,el) - instance = phase_plasticityInstance(material_phaseAt(co,el)) + instance = phase_plasticInstance(material_phaseAt(co,el)) call plastic_isotropic_LiAndItsTangent(my_Li, my_dLi_dS, S ,instance,of) - case default plasticityType + case default plasticType my_Li = 0.0_pReal my_dLi_dS = 0.0_pReal - end select plasticityType + end select plasticType Li = Li + my_Li dLi_dS = dLi_dS + my_dLi_dS @@ -201,7 +201,7 @@ module subroutine constitutive_LiAndItsTangents(Li, dLi_dS, dLi_dFi, & dLi_dFi(1:3,i,1:3,j) = dLi_dFi(1:3,i,1:3,j) + math_I3*temp_33(j,i) + Li*FiInv(j,i) enddo; enddo -end subroutine constitutive_LiAndItsTangents +end subroutine phase_LiAndItsTangents end submodule eigendeformation diff --git a/src/phase_mechanics_eigendeformation_cleavageopening.f90 b/src/phase_mechanical_eigen_cleavageopening.f90 similarity index 100% rename from src/phase_mechanics_eigendeformation_cleavageopening.f90 rename to src/phase_mechanical_eigen_cleavageopening.f90 diff --git a/src/phase_mechanics_eigendeformation_slipplaneopening.f90 b/src/phase_mechanical_eigen_slipplaneopening.f90 similarity index 100% rename from src/phase_mechanics_eigendeformation_slipplaneopening.f90 rename to src/phase_mechanical_eigen_slipplaneopening.f90 diff --git a/src/phase_mechanics_eigendeformation_thermalexpansion.f90 b/src/phase_mechanical_eigen_thermalexpansion.f90 similarity index 100% rename from src/phase_mechanics_eigendeformation_thermalexpansion.f90 rename to src/phase_mechanical_eigen_thermalexpansion.f90 diff --git a/src/phase_mechanics_plastic.f90 b/src/phase_mechanical_plastic.f90 similarity index 91% rename from src/phase_mechanics_plastic.f90 rename to src/phase_mechanical_plastic.f90 index fff1fbdcf..ed1dc64fb 100644 --- a/src/phase_mechanics_plastic.f90 +++ b/src/phase_mechanical_plastic.f90 @@ -270,31 +270,31 @@ module subroutine plastic_LpAndItsTangents(Lp, dLp_dS, dLp_dFi, & me = material_phasememberAt(co,ip,el) ph = material_phaseAt(co,el) - plasticityType: select case (phase_plasticity(material_phaseAt(co,el))) + plasticType: select case (phase_plasticity(material_phaseAt(co,el))) - case (PLASTICITY_NONE_ID) plasticityType + case (PLASTICITY_NONE_ID) plasticType Lp = 0.0_pReal dLp_dMp = 0.0_pReal - case (PLASTICITY_ISOTROPIC_ID) plasticityType + case (PLASTICITY_ISOTROPIC_ID) plasticType call isotropic_LpAndItsTangent(Lp,dLp_dMp,Mp,ph,me) - case (PLASTICITY_PHENOPOWERLAW_ID) plasticityType + case (PLASTICITY_PHENOPOWERLAW_ID) plasticType call phenopowerlaw_LpAndItsTangent(Lp,dLp_dMp,Mp,ph,me) - case (PLASTICITY_KINEHARDENING_ID) plasticityType + case (PLASTICITY_KINEHARDENING_ID) plasticType call kinehardening_LpAndItsTangent(Lp,dLp_dMp,Mp,ph,me) - case (PLASTICITY_NONLOCAL_ID) plasticityType + case (PLASTICITY_NONLOCAL_ID) plasticType call nonlocal_LpAndItsTangent(Lp,dLp_dMp,Mp, thermal_T(ph,me),ph,me,ip,el) - case (PLASTICITY_DISLOTWIN_ID) plasticityType + case (PLASTICITY_DISLOTWIN_ID) plasticType call dislotwin_LpAndItsTangent(Lp,dLp_dMp,Mp, thermal_T(ph,me),ph,me) - case (PLASTICITY_DISLOTUNGSTEN_ID) plasticityType + case (PLASTICITY_DISLOTUNGSTEN_ID) plasticType call dislotungsten_LpAndItsTangent(Lp,dLp_dMp,Mp, thermal_T(ph,me),ph,me) - end select plasticityType + end select plasticType do i=1,3; do j=1,3 dLp_dFi(i,j,1:3,1:3) = matmul(matmul(Fi,S),transpose(dLp_dMp(i,j,1:3,1:3))) + & @@ -323,29 +323,29 @@ module function plastic_dotState(subdt,co,ip,el,ph,me) result(broken) logical :: broken - Mp = matmul(matmul(transpose(constitutive_mech_Fi(ph)%data(1:3,1:3,me)),& - constitutive_mech_Fi(ph)%data(1:3,1:3,me)),constitutive_mech_S(ph)%data(1:3,1:3,me)) + Mp = matmul(matmul(transpose(phase_mechanical_Fi(ph)%data(1:3,1:3,me)),& + phase_mechanical_Fi(ph)%data(1:3,1:3,me)),phase_mechanical_S(ph)%data(1:3,1:3,me)) - plasticityType: select case (phase_plasticity(ph)) + plasticType: select case (phase_plasticity(ph)) - case (PLASTICITY_ISOTROPIC_ID) plasticityType + case (PLASTICITY_ISOTROPIC_ID) plasticType call isotropic_dotState(Mp,ph,me) - case (PLASTICITY_PHENOPOWERLAW_ID) plasticityType + case (PLASTICITY_PHENOPOWERLAW_ID) plasticType call phenopowerlaw_dotState(Mp,ph,me) - case (PLASTICITY_KINEHARDENING_ID) plasticityType + case (PLASTICITY_KINEHARDENING_ID) plasticType call plastic_kinehardening_dotState(Mp,ph,me) - case (PLASTICITY_DISLOTWIN_ID) plasticityType + case (PLASTICITY_DISLOTWIN_ID) plasticType call dislotwin_dotState(Mp,thermal_T(ph,me),ph,me) - case (PLASTICITY_DISLOTUNGSTEN_ID) plasticityType + case (PLASTICITY_DISLOTUNGSTEN_ID) plasticType call dislotungsten_dotState(Mp,thermal_T(ph,me),ph,me) - case (PLASTICITY_NONLOCAL_ID) plasticityType + case (PLASTICITY_NONLOCAL_ID) plasticType call nonlocal_dotState(Mp,thermal_T(ph,me),subdt,ph,me,ip,el) - end select plasticityType + end select plasticType broken = any(IEEE_is_NaN(plasticState(ph)%dotState(:,me))) @@ -369,20 +369,20 @@ module subroutine plastic_dependentState(co, ip, el) ph = material_phaseAt(co,el) me = material_phasememberAt(co,ip,el) - instance = phase_plasticityInstance(ph) + instance = phase_plasticInstance(ph) - plasticityType: select case (phase_plasticity(material_phaseAt(co,el))) + plasticType: select case (phase_plasticity(material_phaseAt(co,el))) - case (PLASTICITY_DISLOTWIN_ID) plasticityType + case (PLASTICITY_DISLOTWIN_ID) plasticType call dislotwin_dependentState(thermal_T(ph,me),instance,me) - case (PLASTICITY_DISLOTUNGSTEN_ID) plasticityType + case (PLASTICITY_DISLOTUNGSTEN_ID) plasticType call dislotungsten_dependentState(instance,me) - case (PLASTICITY_NONLOCAL_ID) plasticityType + case (PLASTICITY_NONLOCAL_ID) plasticType call nonlocal_dependentState(instance,me,ip,el) - end select plasticityType + end select plasticType end subroutine plastic_dependentState @@ -410,24 +410,24 @@ module function plastic_deltaState(co, ip, el, ph, me) result(broken) mySize - Mp = matmul(matmul(transpose(constitutive_mech_Fi(ph)%data(1:3,1:3,me)),& - constitutive_mech_Fi(ph)%data(1:3,1:3,me)),constitutive_mech_S(ph)%data(1:3,1:3,me)) - instance = phase_plasticityInstance(ph) + Mp = matmul(matmul(transpose(phase_mechanical_Fi(ph)%data(1:3,1:3,me)),& + phase_mechanical_Fi(ph)%data(1:3,1:3,me)),phase_mechanical_S(ph)%data(1:3,1:3,me)) + instance = phase_plasticInstance(ph) - plasticityType: select case (phase_plasticity(ph)) + plasticType: select case (phase_plasticity(ph)) - case (PLASTICITY_KINEHARDENING_ID) plasticityType + case (PLASTICITY_KINEHARDENING_ID) plasticType call plastic_kinehardening_deltaState(Mp,instance,me) broken = any(IEEE_is_NaN(plasticState(ph)%deltaState(:,me))) - case (PLASTICITY_NONLOCAL_ID) plasticityType + case (PLASTICITY_NONLOCAL_ID) plasticType call plastic_nonlocal_deltaState(Mp,instance,me,ip,el) broken = any(IEEE_is_NaN(plasticState(ph)%deltaState(:,me))) case default broken = .false. - end select plasticityType + end select plasticType if(.not. broken) then select case(phase_plasticity(ph)) diff --git a/src/phase_mechanics_plastic_dislotungsten.f90 b/src/phase_mechanical_plastic_dislotungsten.f90 similarity index 97% rename from src/phase_mechanics_plastic_dislotungsten.f90 rename to src/phase_mechanical_plastic_dislotungsten.f90 index a47132c63..a9946b6e7 100644 --- a/src/phase_mechanics_plastic_dislotungsten.f90 +++ b/src/phase_mechanical_plastic_dislotungsten.f90 @@ -226,7 +226,7 @@ module function plastic_dislotungsten_init() result(myPlasticity) sizeDotState = size(['rho_mob ','rho_dip ','gamma_sl']) * prm%sum_N_sl sizeState = sizeDotState - call constitutive_allocateState(plasticState(p),Nconstituents,sizeState,sizeDotState,0) + call phase_allocateState(plasticState(p),Nconstituents,sizeState,sizeDotState,0) !-------------------------------------------------------------------------------------------------- ! state aliases and initialization @@ -289,16 +289,16 @@ pure module subroutine dislotungsten_LpAndItsTangent(Lp,dLp_dMp, & integer :: & i,k,l,m,n - real(pReal), dimension(param(phase_plasticityInstance(ph))%sum_N_sl) :: & + real(pReal), dimension(param(phase_plasticInstance(ph))%sum_N_sl) :: & dot_gamma_pos,dot_gamma_neg, & ddot_gamma_dtau_pos,ddot_gamma_dtau_neg Lp = 0.0_pReal dLp_dMp = 0.0_pReal - associate(prm => param(phase_plasticityInstance(ph))) + associate(prm => param(phase_plasticInstance(ph))) - call kinetics(Mp,T,phase_plasticityInstance(ph),me,dot_gamma_pos,dot_gamma_neg,ddot_gamma_dtau_pos,ddot_gamma_dtau_neg) + call kinetics(Mp,T,phase_plasticInstance(ph),me,dot_gamma_pos,dot_gamma_neg,ddot_gamma_dtau_pos,ddot_gamma_dtau_neg) do i = 1, prm%sum_N_sl Lp = Lp + (dot_gamma_pos(i)+dot_gamma_neg(i))*prm%P_sl(1:3,1:3,i) forall (k=1:3,l=1:3,m=1:3,n=1:3) & @@ -327,7 +327,7 @@ module subroutine dislotungsten_dotState(Mp,T,ph,me) real(pReal) :: & VacancyDiffusion - real(pReal), dimension(param(phase_plasticityInstance(ph))%sum_N_sl) :: & + real(pReal), dimension(param(phase_plasticInstance(ph))%sum_N_sl) :: & gdot_pos, gdot_neg,& tau_pos,& tau_neg, & @@ -336,10 +336,10 @@ module subroutine dislotungsten_dotState(Mp,T,ph,me) dot_rho_dip_climb, & dip_distance - associate(prm => param(phase_plasticityInstance(ph)), stt => state(phase_plasticityInstance(ph)),& - dot => dotState(phase_plasticityInstance(ph)), dst => dependentState(phase_plasticityInstance(ph))) + associate(prm => param(phase_plasticInstance(ph)), stt => state(phase_plasticInstance(ph)),& + dot => dotState(phase_plasticInstance(ph)), dst => dependentState(phase_plasticInstance(ph))) - call kinetics(Mp,T,phase_plasticityInstance(ph),me,& + call kinetics(Mp,T,phase_plasticInstance(ph),me,& gdot_pos,gdot_neg, & tau_pos_out = tau_pos,tau_neg_out = tau_neg) diff --git a/src/phase_mechanics_plastic_dislotwin.f90 b/src/phase_mechanical_plastic_dislotwin.f90 similarity index 97% rename from src/phase_mechanics_plastic_dislotwin.f90 rename to src/phase_mechanical_plastic_dislotwin.f90 index 9f7464323..e1259fbd2 100644 --- a/src/phase_mechanics_plastic_dislotwin.f90 +++ b/src/phase_mechanical_plastic_dislotwin.f90 @@ -415,7 +415,7 @@ module function plastic_dislotwin_init() result(myPlasticity) sizeState = sizeDotState - call constitutive_allocateState(plasticState(p),Nconstituents,sizeState,sizeDotState,0) + call phase_allocateState(plasticState(p),Nconstituents,sizeState,sizeDotState,0) !-------------------------------------------------------------------------------------------------- ! locally defined state aliases and initialization of state0 and atol @@ -496,8 +496,8 @@ module function plastic_dislotwin_homogenizedC(ph,me) result(homogenizedC) real(pReal) :: f_unrotated - associate(prm => param(phase_plasticityInstance(ph)),& - stt => state(phase_plasticityInstance(ph))) + associate(prm => param(phase_plasticInstance(ph)),& + stt => state(phase_plasticInstance(ph))) f_unrotated = 1.0_pReal & - sum(stt%f_tw(1:prm%sum_N_tw,me)) & @@ -535,11 +535,11 @@ module subroutine dislotwin_LpAndItsTangent(Lp,dLp_dMp,Mp,T,ph,me) BoltzmannRatio, & ddot_gamma_dtau, & tau - real(pReal), dimension(param(phase_plasticityInstance(ph))%sum_N_sl) :: & + real(pReal), dimension(param(phase_plasticInstance(ph))%sum_N_sl) :: & dot_gamma_sl,ddot_gamma_dtau_slip - real(pReal), dimension(param(phase_plasticityInstance(ph))%sum_N_tw) :: & + real(pReal), dimension(param(phase_plasticInstance(ph))%sum_N_tw) :: & dot_gamma_twin,ddot_gamma_dtau_twin - real(pReal), dimension(param(phase_plasticityInstance(ph))%sum_N_tr) :: & + real(pReal), dimension(param(phase_plasticInstance(ph))%sum_N_tr) :: & dot_gamma_tr,ddot_gamma_dtau_trans real(pReal):: dot_gamma_sb real(pReal), dimension(3,3) :: eigVectors, P_sb @@ -564,7 +564,7 @@ module subroutine dislotwin_LpAndItsTangent(Lp,dLp_dMp,Mp,T,ph,me) 0, 1, 1 & ],pReal),[ 3,6]) - associate(prm => param(phase_plasticityInstance(ph)), stt => state(phase_plasticityInstance(ph))) + associate(prm => param(phase_plasticInstance(ph)), stt => state(phase_plasticInstance(ph))) f_unrotated = 1.0_pReal & - sum(stt%f_tw(1:prm%sum_N_tw,me)) & @@ -573,7 +573,7 @@ module subroutine dislotwin_LpAndItsTangent(Lp,dLp_dMp,Mp,T,ph,me) Lp = 0.0_pReal dLp_dMp = 0.0_pReal - call kinetics_slip(Mp,T,phase_plasticityInstance(ph),me,dot_gamma_sl,ddot_gamma_dtau_slip) + call kinetics_slip(Mp,T,phase_plasticInstance(ph),me,dot_gamma_sl,ddot_gamma_dtau_slip) slipContribution: do i = 1, prm%sum_N_sl Lp = Lp + dot_gamma_sl(i)*prm%P_sl(1:3,1:3,i) forall (k=1:3,l=1:3,m=1:3,n=1:3) & @@ -581,7 +581,7 @@ module subroutine dislotwin_LpAndItsTangent(Lp,dLp_dMp,Mp,T,ph,me) + ddot_gamma_dtau_slip(i) * prm%P_sl(k,l,i) * prm%P_sl(m,n,i) enddo slipContribution - call kinetics_twin(Mp,T,dot_gamma_sl,phase_plasticityInstance(ph),me,dot_gamma_twin,ddot_gamma_dtau_twin) + call kinetics_twin(Mp,T,dot_gamma_sl,phase_plasticInstance(ph),me,dot_gamma_twin,ddot_gamma_dtau_twin) twinContibution: do i = 1, prm%sum_N_tw Lp = Lp + dot_gamma_twin(i)*prm%P_tw(1:3,1:3,i) forall (k=1:3,l=1:3,m=1:3,n=1:3) & @@ -589,7 +589,7 @@ module subroutine dislotwin_LpAndItsTangent(Lp,dLp_dMp,Mp,T,ph,me) + ddot_gamma_dtau_twin(i)* prm%P_tw(k,l,i)*prm%P_tw(m,n,i) enddo twinContibution - call kinetics_trans(Mp,T,dot_gamma_sl,phase_plasticityInstance(ph),me,dot_gamma_tr,ddot_gamma_dtau_trans) + call kinetics_trans(Mp,T,dot_gamma_sl,phase_plasticInstance(ph),me,dot_gamma_tr,ddot_gamma_dtau_trans) transContibution: do i = 1, prm%sum_N_tr Lp = Lp + dot_gamma_tr(i)*prm%P_tr(1:3,1:3,i) forall (k=1:3,l=1:3,m=1:3,n=1:3) & @@ -653,24 +653,24 @@ module subroutine dislotwin_dotState(Mp,T,ph,me) tau, & sigma_cl, & !< climb stress b_d !< ratio of Burgers vector to stacking fault width - real(pReal), dimension(param(phase_plasticityInstance(ph))%sum_N_sl) :: & + real(pReal), dimension(param(phase_plasticInstance(ph))%sum_N_sl) :: & dot_rho_dip_formation, & dot_rho_dip_climb, & rho_dip_distance_min, & dot_gamma_sl - real(pReal), dimension(param(phase_plasticityInstance(ph))%sum_N_tw) :: & + real(pReal), dimension(param(phase_plasticInstance(ph))%sum_N_tw) :: & dot_gamma_twin - real(pReal), dimension(param(phase_plasticityInstance(ph))%sum_N_tr) :: & + real(pReal), dimension(param(phase_plasticInstance(ph))%sum_N_tr) :: & dot_gamma_tr - associate(prm => param(phase_plasticityInstance(ph)), stt => state(phase_plasticityInstance(ph)), & - dot => dotState(phase_plasticityInstance(ph)), dst => dependentState(phase_plasticityInstance(ph))) + associate(prm => param(phase_plasticInstance(ph)), stt => state(phase_plasticInstance(ph)), & + dot => dotState(phase_plasticInstance(ph)), dst => dependentState(phase_plasticInstance(ph))) f_unrotated = 1.0_pReal & - sum(stt%f_tw(1:prm%sum_N_tw,me)) & - sum(stt%f_tr(1:prm%sum_N_tr,me)) - call kinetics_slip(Mp,T,phase_plasticityInstance(ph),me,dot_gamma_sl) + call kinetics_slip(Mp,T,phase_plasticInstance(ph),me,dot_gamma_sl) dot%gamma_sl(:,me) = abs(dot_gamma_sl) rho_dip_distance_min = prm%D_a*prm%b_sl @@ -721,10 +721,10 @@ module subroutine dislotwin_dotState(Mp,T,ph,me) - 2.0_pReal*rho_dip_distance_min/prm%b_sl * stt%rho_dip(:,me)*abs(dot_gamma_sl) & - dot_rho_dip_climb - call kinetics_twin(Mp,T,dot_gamma_sl,phase_plasticityInstance(ph),me,dot_gamma_twin) + call kinetics_twin(Mp,T,dot_gamma_sl,phase_plasticInstance(ph),me,dot_gamma_twin) dot%f_tw(:,me) = f_unrotated*dot_gamma_twin/prm%gamma_char - call kinetics_trans(Mp,T,dot_gamma_sl,phase_plasticityInstance(ph),me,dot_gamma_tr) + call kinetics_trans(Mp,T,dot_gamma_sl,phase_plasticInstance(ph),me,dot_gamma_tr) dot%f_tr(:,me) = f_unrotated*dot_gamma_tr end associate diff --git a/src/phase_mechanics_plastic_isotropic.f90 b/src/phase_mechanical_plastic_isotropic.f90 similarity index 97% rename from src/phase_mechanics_plastic_isotropic.f90 rename to src/phase_mechanical_plastic_isotropic.f90 index 6789e74b4..1a4e1449a 100644 --- a/src/phase_mechanics_plastic_isotropic.f90 +++ b/src/phase_mechanical_plastic_isotropic.f90 @@ -135,7 +135,7 @@ module function plastic_isotropic_init() result(myPlasticity) sizeDotState = size(['xi ','gamma']) sizeState = sizeDotState - call constitutive_allocateState(plasticState(p),Nconstituents,sizeState,sizeDotState,0) + call phase_allocateState(plasticState(p),Nconstituents,sizeState,sizeDotState,0) !-------------------------------------------------------------------------------------------------- ! state aliases and initialization @@ -190,7 +190,7 @@ module subroutine isotropic_LpAndItsTangent(Lp,dLp_dMp,Mp,ph,me) integer :: & k, l, m, n - associate(prm => param(phase_plasticityInstance(ph)), stt => state(phase_plasticityInstance(ph))) + associate(prm => param(phase_plasticInstance(ph)), stt => state(phase_plasticInstance(ph))) Mp_dev = math_deviatoric33(Mp) squarenorm_Mp_dev = math_tensordot(Mp_dev,Mp_dev) @@ -275,8 +275,8 @@ module subroutine isotropic_dotState(Mp,ph,me) xi_inf_star, & !< saturation xi norm_Mp !< norm of the (deviatoric) Mandel stress - associate(prm => param(phase_plasticityInstance(ph)), stt => state(phase_plasticityInstance(ph)), & - dot => dotState(phase_plasticityInstance(ph))) + associate(prm => param(phase_plasticInstance(ph)), stt => state(phase_plasticInstance(ph)), & + dot => dotState(phase_plasticInstance(ph))) if (prm%dilatation) then norm_Mp = sqrt(math_tensordot(Mp,Mp)) diff --git a/src/phase_mechanics_plastic_kinehardening.f90 b/src/phase_mechanical_plastic_kinehardening.f90 similarity index 97% rename from src/phase_mechanics_plastic_kinehardening.f90 rename to src/phase_mechanical_plastic_kinehardening.f90 index 919302bc1..f00e4171b 100644 --- a/src/phase_mechanics_plastic_kinehardening.f90 +++ b/src/phase_mechanical_plastic_kinehardening.f90 @@ -180,7 +180,7 @@ module function plastic_kinehardening_init() result(myPlasticity) sizeDeltaState = size(['sense ', 'chi0 ', 'gamma0' ]) * prm%sum_N_sl !ToDo: adjust names sizeState = sizeDotState + sizeDeltaState - call constitutive_allocateState(plasticState(p),Nconstituents,sizeState,sizeDotState,sizeDeltaState) + call phase_allocateState(plasticState(p),Nconstituents,sizeState,sizeDotState,sizeDeltaState) !-------------------------------------------------------------------------------------------------- ! state aliases and initialization @@ -255,16 +255,16 @@ pure module subroutine kinehardening_LpAndItsTangent(Lp,dLp_dMp,Mp,ph,me) integer :: & i,k,l,m,n - real(pReal), dimension(param(phase_plasticityInstance(ph))%sum_N_sl) :: & + real(pReal), dimension(param(phase_plasticInstance(ph))%sum_N_sl) :: & gdot_pos,gdot_neg, & dgdot_dtau_pos,dgdot_dtau_neg Lp = 0.0_pReal dLp_dMp = 0.0_pReal - associate(prm => param(phase_plasticityInstance(ph))) + associate(prm => param(phase_plasticInstance(ph))) - call kinetics(Mp,phase_plasticityInstance(ph),me,gdot_pos,gdot_neg,dgdot_dtau_pos,dgdot_dtau_neg) + call kinetics(Mp,phase_plasticInstance(ph),me,gdot_pos,gdot_neg,dgdot_dtau_pos,dgdot_dtau_neg) do i = 1, prm%sum_N_sl Lp = Lp + (gdot_pos(i)+gdot_neg(i))*prm%P(1:3,1:3,i) @@ -292,14 +292,14 @@ module subroutine plastic_kinehardening_dotState(Mp,ph,me) real(pReal) :: & sumGamma - real(pReal), dimension(param(phase_plasticityInstance(ph))%sum_N_sl) :: & + real(pReal), dimension(param(phase_plasticInstance(ph))%sum_N_sl) :: & gdot_pos,gdot_neg - associate(prm => param(phase_plasticityInstance(ph)), stt => state(phase_plasticityInstance(ph)),& - dot => dotState(phase_plasticityInstance(ph))) + associate(prm => param(phase_plasticInstance(ph)), stt => state(phase_plasticInstance(ph)),& + dot => dotState(phase_plasticInstance(ph))) - call kinetics(Mp,phase_plasticityInstance(ph),me,gdot_pos,gdot_neg) + call kinetics(Mp,phase_plasticInstance(ph),me,gdot_pos,gdot_neg) dot%accshear(:,me) = abs(gdot_pos+gdot_neg) sumGamma = sum(stt%accshear(:,me)) diff --git a/src/phase_mechanics_plastic_none.f90 b/src/phase_mechanical_plastic_none.f90 similarity index 96% rename from src/phase_mechanics_plastic_none.f90 rename to src/phase_mechanical_plastic_none.f90 index b8d1678eb..b95eaa039 100644 --- a/src/phase_mechanics_plastic_none.f90 +++ b/src/phase_mechanical_plastic_none.f90 @@ -44,7 +44,7 @@ module function plastic_none_init() result(myPlasticity) phase => phases%get(p) if(.not. myPlasticity(p)) cycle Nconstituents = count(material_phaseAt2 == p) - call constitutive_allocateState(plasticState(p),Nconstituents,0,0,0) + call phase_allocateState(plasticState(p),Nconstituents,0,0,0) enddo end function plastic_none_init diff --git a/src/phase_mechanics_plastic_nonlocal.f90 b/src/phase_mechanical_plastic_nonlocal.f90 similarity index 97% rename from src/phase_mechanics_plastic_nonlocal.f90 rename to src/phase_mechanical_plastic_nonlocal.f90 index 693ffcf93..724086916 100644 --- a/src/phase_mechanics_plastic_nonlocal.f90 +++ b/src/phase_mechanical_plastic_nonlocal.f90 @@ -407,7 +407,7 @@ module function plastic_nonlocal_init() result(myPlasticity) 'maxDipoleHeightEdge ','maxDipoleHeightScrew' ]) * prm%sum_N_sl !< other dependent state variables that are not updated by microstructure sizeDeltaState = sizeDotState - call constitutive_allocateState(plasticState(p),Nconstituents,sizeState,sizeDotState,sizeDeltaState) + call phase_allocateState(plasticState(p),Nconstituents,sizeState,sizeDotState,sizeDeltaState) plasticState(p)%nonlocal = pl%get_asBool('nonlocal') if(plasticState(p)%nonlocal .and. .not. allocated(IPneighborhood)) & @@ -642,8 +642,8 @@ module subroutine nonlocal_dependentState(instance, me, ip, el) rho0 = getRho0(instance,me,ip,el) if (.not. phase_localPlasticity(material_phaseAt(1,el)) .and. prm%shortRangeStressCorrection) then ph = material_phaseAt(1,el) - invFp = math_inv33(constitutive_mech_Fp(ph)%data(1:3,1:3,me)) - invFe = math_inv33(constitutive_mech_Fe(ph)%data(1:3,1:3,me)) + invFp = math_inv33(phase_mechanical_Fp(ph)%data(1:3,1:3,me)) + invFe = math_inv33(phase_mechanical_Fe(ph)%data(1:3,1:3,me)) rho_edg_delta = rho0(:,mob_edg_pos) - rho0(:,mob_edg_neg) rho_scr_delta = rho0(:,mob_scr_pos) - rho0(:,mob_scr_neg) @@ -662,7 +662,7 @@ module subroutine nonlocal_dependentState(instance, me, ip, el) neighbor_ip = IPneighborhood(2,n,ip,el) no = material_phasememberAt(1,neighbor_ip,neighbor_el) if (neighbor_el > 0 .and. neighbor_ip > 0) then - neighbor_instance = phase_plasticityInstance(material_phaseAt(1,neighbor_el)) + neighbor_instance = phase_plasticInstance(material_phaseAt(1,neighbor_el)) if (neighbor_instance == instance) then nRealNeighbors = nRealNeighbors + 1.0_pReal @@ -782,25 +782,25 @@ module subroutine nonlocal_LpAndItsTangent(Lp,dLp_dMp, & l, & t, & !< dislocation type s !< index of my current slip system - real(pReal), dimension(param(phase_plasticityInstance(ph))%sum_N_sl,8) :: & + real(pReal), dimension(param(phase_plasticInstance(ph))%sum_N_sl,8) :: & rhoSgl !< single dislocation densities (including blocked) - real(pReal), dimension(param(phase_plasticityInstance(ph))%sum_N_sl,10) :: & + real(pReal), dimension(param(phase_plasticInstance(ph))%sum_N_sl,10) :: & rho - real(pReal), dimension(param(phase_plasticityInstance(ph))%sum_N_sl,4) :: & + real(pReal), dimension(param(phase_plasticInstance(ph))%sum_N_sl,4) :: & v, & !< velocity tauNS, & !< resolved shear stress including non Schmid and backstress terms dv_dtau, & !< velocity derivative with respect to the shear stress dv_dtauNS !< velocity derivative with respect to the shear stress - real(pReal), dimension(param(phase_plasticityInstance(ph))%sum_N_sl) :: & + real(pReal), dimension(param(phase_plasticInstance(ph))%sum_N_sl) :: & tau, & !< resolved shear stress including backstress terms gdotTotal !< shear rate - associate(prm => param(phase_plasticityInstance(ph)),dst=>microstructure(phase_plasticityInstance(ph)),& - stt=>state(phase_plasticityInstance(ph))) + associate(prm => param(phase_plasticInstance(ph)),dst=>microstructure(phase_plasticInstance(ph)),& + stt=>state(phase_plasticInstance(ph))) ns = prm%sum_N_sl !*** shortcut to state variables - rho = getRho(phase_plasticityInstance(ph),me,ip,el) + rho = getRho(phase_plasticInstance(ph),me,ip,el) rhoSgl = rho(:,sgl) do s = 1,ns @@ -820,7 +820,7 @@ module subroutine nonlocal_LpAndItsTangent(Lp,dLp_dMp, & ! edges call kinetics(v(:,1), dv_dtau(:,1), dv_dtauNS(:,1), & - tau, tauNS(:,1), dst%tau_pass(:,me),1,Temperature, phase_plasticityInstance(ph)) + tau, tauNS(:,1), dst%tau_pass(:,me),1,Temperature, phase_plasticInstance(ph)) v(:,2) = v(:,1) dv_dtau(:,2) = dv_dtau(:,1) dv_dtauNS(:,2) = dv_dtauNS(:,1) @@ -833,7 +833,7 @@ module subroutine nonlocal_LpAndItsTangent(Lp,dLp_dMp, & else do t = 3,4 call kinetics(v(:,t), dv_dtau(:,t), dv_dtauNS(:,t), & - tau, tauNS(:,t), dst%tau_pass(:,me),2,Temperature, phase_plasticityInstance(ph)) + tau, tauNS(:,t), dst%tau_pass(:,me),2,Temperature, phase_plasticInstance(ph)) enddo endif @@ -992,7 +992,7 @@ module subroutine nonlocal_dotState(Mp, Temperature,timestep, & c, & !< character of dislocation t, & !< type of dislocation s !< index of my current slip system - real(pReal), dimension(param(phase_plasticityInstance(ph))%sum_N_sl,10) :: & + real(pReal), dimension(param(phase_plasticInstance(ph))%sum_N_sl,10) :: & rho, & rho0, & !< dislocation density at beginning of time step rhoDot, & !< density evolution @@ -1000,17 +1000,17 @@ module subroutine nonlocal_dotState(Mp, Temperature,timestep, & rhoDotSingle2DipoleGlide, & !< density evolution by dipole formation (by glide) rhoDotAthermalAnnihilation, & !< density evolution by athermal annihilation rhoDotThermalAnnihilation !< density evolution by thermal annihilation - real(pReal), dimension(param(phase_plasticityInstance(ph))%sum_N_sl,8) :: & + real(pReal), dimension(param(phase_plasticInstance(ph))%sum_N_sl,8) :: & rhoSgl, & !< current single dislocation densities (positive/negative screw and edge without dipoles) my_rhoSgl0 !< single dislocation densities of central ip (positive/negative screw and edge without dipoles) - real(pReal), dimension(param(phase_plasticityInstance(ph))%sum_N_sl,4) :: & + real(pReal), dimension(param(phase_plasticInstance(ph))%sum_N_sl,4) :: & v, & !< current dislocation glide velocity v0, & gdot !< shear rates - real(pReal), dimension(param(phase_plasticityInstance(ph))%sum_N_sl) :: & + real(pReal), dimension(param(phase_plasticInstance(ph))%sum_N_sl) :: & tau, & !< current resolved shear stress vClimb !< climb velocity of edge dipoles - real(pReal), dimension(param(phase_plasticityInstance(ph))%sum_N_sl,2) :: & + real(pReal), dimension(param(phase_plasticInstance(ph))%sum_N_sl,2) :: & rhoDip, & !< current dipole dislocation densities (screw and edge dipoles) dLower, & !< minimum stable dipole distance for edges and screws dUpper !< current maximum stable dipole distance for edges and screws @@ -1022,22 +1022,22 @@ module subroutine nonlocal_dotState(Mp, Temperature,timestep, & return endif - associate(prm => param(phase_plasticityInstance(ph)), & - dst => microstructure(phase_plasticityInstance(ph)), & - dot => dotState(phase_plasticityInstance(ph)), & - stt => state(phase_plasticityInstance(ph))) + associate(prm => param(phase_plasticInstance(ph)), & + dst => microstructure(phase_plasticInstance(ph)), & + dot => dotState(phase_plasticInstance(ph)), & + stt => state(phase_plasticInstance(ph))) ns = prm%sum_N_sl tau = 0.0_pReal gdot = 0.0_pReal - rho = getRho(phase_plasticityInstance(ph),me,ip,el) + rho = getRho(phase_plasticInstance(ph),me,ip,el) rhoSgl = rho(:,sgl) rhoDip = rho(:,dip) - rho0 = getRho0(phase_plasticityInstance(ph),me,ip,el) + rho0 = getRho0(phase_plasticInstance(ph),me,ip,el) my_rhoSgl0 = rho0(:,sgl) - forall (s = 1:ns, t = 1:4) v(s,t) = plasticState(ph)%state(iV(s,t,phase_plasticityInstance(ph)),me) + forall (s = 1:ns, t = 1:4) v(s,t) = plasticState(ph)%state(iV(s,t,phase_plasticInstance(ph)),me) gdot = rhoSgl(:,1:4) * v * spread(prm%b_sl,2,4) #ifdef DEBUG @@ -1086,7 +1086,7 @@ module subroutine nonlocal_dotState(Mp, Temperature,timestep, & * sqrt(stt%rho_forest(:,me)) / prm%i_sl / prm%b_sl, 2, 4) endif isBCC - forall (s = 1:ns, t = 1:4) v0(s,t) = plasticState(ph)%state0(iV(s,t,phase_plasticityInstance(ph)),me) + forall (s = 1:ns, t = 1:4) v0(s,t) = plasticState(ph)%state0(iV(s,t,phase_plasticInstance(ph)),me) !**************************************************************************** @@ -1142,7 +1142,7 @@ module subroutine nonlocal_dotState(Mp, Temperature,timestep, & - rhoDip(s,1) / timestep - rhoDotAthermalAnnihilation(s,9) & - rhoDotSingle2DipoleGlide(s,9)) ! make sure that we do not annihilate more dipoles than we have - rhoDot = rhoDotFlux(timestep, phase_plasticityInstance(ph),me,ip,el) & + rhoDot = rhoDotFlux(timestep, phase_plasticInstance(ph),me,ip,el) & + rhoDotMultiplication & + rhoDotSingle2DipoleGlide & + rhoDotAthermalAnnihilation & @@ -1284,8 +1284,8 @@ function rhoDotFlux(timestep,instance,me,ip,el) m(1:3,:,3) = -prm%slip_transverse m(1:3,:,4) = prm%slip_transverse - my_F = constitutive_mech_F(ph)%data(1:3,1:3,me) - my_Fe = matmul(my_F, math_inv33(constitutive_mech_Fp(ph)%data(1:3,1:3,me))) + my_F = phase_mechanical_F(ph)%data(1:3,1:3,me) + my_Fe = matmul(my_F, math_inv33(phase_mechanical_Fp(ph)%data(1:3,1:3,me))) neighbors: do n = 1,nIPneighbors @@ -1301,9 +1301,9 @@ function rhoDotFlux(timestep,instance,me,ip,el) opposite_n = IPneighborhood(3,opposite_neighbor,ip,el) if (neighbor_n > 0) then ! if neighbor exists, average deformation gradient - neighbor_instance = phase_plasticityInstance(material_phaseAt(1,neighbor_el)) - neighbor_F = constitutive_mech_F(np)%data(1:3,1:3,no) - neighbor_Fe = matmul(neighbor_F, math_inv33(constitutive_mech_Fp(np)%data(1:3,1:3,no))) + neighbor_instance = phase_plasticInstance(material_phaseAt(1,neighbor_el)) + neighbor_F = phase_mechanical_F(np)%data(1:3,1:3,no) + neighbor_Fe = matmul(neighbor_F, math_inv33(phase_mechanical_Fp(np)%data(1:3,1:3,no))) Favg = 0.5_pReal * (my_F + neighbor_F) else ! if no neighbor, take my value as average Favg = my_F diff --git a/src/phase_mechanics_plastic_phenopowerlaw.f90 b/src/phase_mechanical_plastic_phenopowerlaw.f90 similarity index 96% rename from src/phase_mechanics_plastic_phenopowerlaw.f90 rename to src/phase_mechanical_plastic_phenopowerlaw.f90 index ea2f53100..f9791faa6 100644 --- a/src/phase_mechanics_plastic_phenopowerlaw.f90 +++ b/src/phase_mechanical_plastic_phenopowerlaw.f90 @@ -231,7 +231,7 @@ module function plastic_phenopowerlaw_init() result(myPlasticity) sizeState = sizeDotState - call constitutive_allocateState(plasticState(p),Nconstituents,sizeState,sizeDotState,0) + call phase_allocateState(plasticState(p),Nconstituents,sizeState,sizeDotState,0) !-------------------------------------------------------------------------------------------------- ! state aliases and initialization @@ -300,18 +300,18 @@ pure module subroutine phenopowerlaw_LpAndItsTangent(Lp,dLp_dMp,Mp,ph,me) integer :: & i,k,l,m,n - real(pReal), dimension(param(phase_plasticityInstance(ph))%sum_N_sl) :: & + real(pReal), dimension(param(phase_plasticInstance(ph))%sum_N_sl) :: & gdot_slip_pos,gdot_slip_neg, & dgdot_dtauslip_pos,dgdot_dtauslip_neg - real(pReal), dimension(param(phase_plasticityInstance(ph))%sum_N_tw) :: & + real(pReal), dimension(param(phase_plasticInstance(ph))%sum_N_tw) :: & gdot_twin,dgdot_dtautwin Lp = 0.0_pReal dLp_dMp = 0.0_pReal - associate(prm => param(phase_plasticityInstance(ph))) + associate(prm => param(phase_plasticInstance(ph))) - call kinetics_slip(Mp,phase_plasticityInstance(ph),me,gdot_slip_pos,gdot_slip_neg,dgdot_dtauslip_pos,dgdot_dtauslip_neg) + call kinetics_slip(Mp,phase_plasticInstance(ph),me,gdot_slip_pos,gdot_slip_neg,dgdot_dtauslip_pos,dgdot_dtauslip_neg) slipSystems: do i = 1, prm%sum_N_sl Lp = Lp + (gdot_slip_pos(i)+gdot_slip_neg(i))*prm%P_sl(1:3,1:3,i) forall (k=1:3,l=1:3,m=1:3,n=1:3) & @@ -320,7 +320,7 @@ pure module subroutine phenopowerlaw_LpAndItsTangent(Lp,dLp_dMp,Mp,ph,me) + dgdot_dtauslip_neg(i) * prm%P_sl(k,l,i) * prm%nonSchmid_neg(m,n,i) enddo slipSystems - call kinetics_twin(Mp,phase_plasticityInstance(ph),me,gdot_twin,dgdot_dtautwin) + call kinetics_twin(Mp,phase_plasticInstance(ph),me,gdot_twin,dgdot_dtautwin) twinSystems: do i = 1, prm%sum_N_tw Lp = Lp + gdot_twin(i)*prm%P_tw(1:3,1:3,i) forall (k=1:3,l=1:3,m=1:3,n=1:3) & @@ -348,12 +348,12 @@ module subroutine phenopowerlaw_dotState(Mp,ph,me) c_SlipSlip,c_TwinSlip,c_TwinTwin, & xi_slip_sat_offset,& sumGamma,sumF - real(pReal), dimension(param(phase_plasticityInstance(ph))%sum_N_sl) :: & + real(pReal), dimension(param(phase_plasticInstance(ph))%sum_N_sl) :: & left_SlipSlip,right_SlipSlip, & gdot_slip_pos,gdot_slip_neg - associate(prm => param(phase_plasticityInstance(ph)), stt => state(phase_plasticityInstance(ph)), & - dot => dotState(phase_plasticityInstance(ph))) + associate(prm => param(phase_plasticInstance(ph)), stt => state(phase_plasticInstance(ph)), & + dot => dotState(phase_plasticInstance(ph))) sumGamma = sum(stt%gamma_slip(:,me)) sumF = sum(stt%gamma_twin(:,me)/prm%gamma_tw_char) @@ -373,9 +373,9 @@ module subroutine phenopowerlaw_dotState(Mp,ph,me) !-------------------------------------------------------------------------------------------------- ! shear rates - call kinetics_slip(Mp,phase_plasticityInstance(ph),me,gdot_slip_pos,gdot_slip_neg) + call kinetics_slip(Mp,phase_plasticInstance(ph),me,gdot_slip_pos,gdot_slip_neg) dot%gamma_slip(:,me) = abs(gdot_slip_pos+gdot_slip_neg) - call kinetics_twin(Mp,phase_plasticityInstance(ph),me,dot%gamma_twin(:,me)) + call kinetics_twin(Mp,phase_plasticInstance(ph),me,dot%gamma_twin(:,me)) !-------------------------------------------------------------------------------------------------- ! hardening diff --git a/src/phase_thermal.f90 b/src/phase_thermal.f90 index d5d52b010..85ca2f7a5 100644 --- a/src/phase_thermal.f90 +++ b/src/phase_thermal.f90 @@ -124,7 +124,7 @@ end subroutine thermal_init !---------------------------------------------------------------------------------------------- !< @brief calculates thermal dissipation rate !---------------------------------------------------------------------------------------------- -module subroutine constitutive_thermal_getRate(TDot, ph,me) +module subroutine phase_thermal_getRate(TDot, ph,me) integer, intent(in) :: ph, me real(pReal), intent(out) :: & @@ -153,13 +153,13 @@ module subroutine constitutive_thermal_getRate(TDot, ph,me) enddo -end subroutine constitutive_thermal_getRate +end subroutine phase_thermal_getRate !-------------------------------------------------------------------------------------------------- !> @brief contains the constitutive equation for calculating the rate of change of microstructure !-------------------------------------------------------------------------------------------------- -function constitutive_thermal_collectDotState(ph,me) result(broken) +function phase_thermal_collectDotState(ph,me) result(broken) integer, intent(in) :: ph, me logical :: broken @@ -178,7 +178,7 @@ function constitutive_thermal_collectDotState(ph,me) result(broken) enddo SourceLoop -end function constitutive_thermal_collectDotState +end function phase_thermal_collectDotState module function thermal_stress(Delta_t,ph,me) result(converged_) @@ -207,7 +207,7 @@ function integrateThermalState(Delta_t, ph,me) result(broken) so, & sizeDotState - broken = constitutive_thermal_collectDotState(ph,me) + broken = phase_thermal_collectDotState(ph,me) if(broken) return do so = 1, thermal_Nsources(ph) @@ -264,7 +264,7 @@ end function thermal_dot_T !---------------------------------------------------------------------------------------------- !< @brief Set temperature !---------------------------------------------------------------------------------------------- -module subroutine constitutive_thermal_setField(T,dot_T, co,ce) +module subroutine phase_thermal_setField(T,dot_T, co,ce) real(pReal), intent(in) :: T, dot_T integer, intent(in) :: ce, co @@ -273,7 +273,7 @@ module subroutine constitutive_thermal_setField(T,dot_T, co,ce) current(material_phaseAt2(co,ce))%T(material_phaseMemberAt2(co,ce)) = T current(material_phaseAt2(co,ce))%dot_T(material_phaseMemberAt2(co,ce)) = dot_T -end subroutine constitutive_thermal_setField +end subroutine phase_thermal_setField diff --git a/src/phase_thermal_dissipation.f90 b/src/phase_thermal_dissipation.f90 index 7a043308d..3c0095401 100644 --- a/src/phase_thermal_dissipation.f90 +++ b/src/phase_thermal_dissipation.f90 @@ -56,7 +56,7 @@ module function dissipation_init(source_length) result(mySources) prm%kappa = src%get_asFloat('kappa') Nconstituents = count(material_phaseAt2 == ph) - call constitutive_allocateState(thermalState(ph)%p(so),Nconstituents,0,0,0) + call phase_allocateState(thermalState(ph)%p(so),Nconstituents,0,0,0) end associate endif @@ -78,7 +78,7 @@ module subroutine dissipation_getRate(TDot, ph,me) associate(prm => param(ph)) - TDot = prm%kappa*sum(abs(mech_S(ph,me)*mech_L_p(ph,me))) + TDot = prm%kappa*sum(abs(mechanical_S(ph,me)*mechanical_L_p(ph,me))) end associate end subroutine dissipation_getRate diff --git a/src/phase_thermal_externalheat.f90 b/src/phase_thermal_externalheat.f90 index ddae6763b..d2874ded0 100644 --- a/src/phase_thermal_externalheat.f90 +++ b/src/phase_thermal_externalheat.f90 @@ -69,7 +69,7 @@ module function externalheat_init(source_length) result(mySources) prm%f_T = src%get_asFloats('f_T',requiredSize = size(prm%t_n)) Nconstituents = count(material_phaseAt2 == ph) - call constitutive_allocateState(thermalState(ph)%p(so),Nconstituents,1,1,0) + call phase_allocateState(thermalState(ph)%p(so),Nconstituents,1,1,0) end associate endif enddo From e8fae6b2a719eab09d2cdc21386bf11e28e7c320 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Thu, 11 Feb 2021 21:56:53 +0100 Subject: [PATCH 17/60] simplified --- python/damask/_vtk.py | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/python/damask/_vtk.py b/python/damask/_vtk.py index ad017ee1e..00a07efa5 100644 --- a/python/damask/_vtk.py +++ b/python/damask/_vtk.py @@ -347,23 +347,21 @@ class VTK: See http://compilatrix.com/article/vtk-1 for further ideas. """ - def screen_size(): + try: + import wx + _ = wx.App(False) # noqa + width, height = wx.GetDisplaySize() + except ImportError: try: - import wx - _ = wx.App(False) # noqa - width, height = wx.GetDisplaySize() - except ImportError: - try: - import tkinter - tk = tkinter.Tk() - width = tk.winfo_screenwidth() - height = tk.winfo_screenheight() - tk.destroy() - except Exception as e: - width = 1024 - height = 768 + import tkinter + tk = tkinter.Tk() + width = tk.winfo_screenwidth() + height = tk.winfo_screenheight() + tk.destroy() + except Exception as e: + width = 1024 + height = 768 - return (width,height) mapper = vtk.vtkDataSetMapper() mapper.SetInputData(self.vtk_data) actor = vtk.vtkActor() @@ -377,7 +375,7 @@ class VTK: ren.AddActor(actor) ren.SetBackground(0.2,0.2,0.2) - window.SetSize(screen_size[0],screen_size[1]) + window.SetSize(width,height) iren = vtk.vtkRenderWindowInteractor() iren.SetRenderWindow(window) From 09c330b8d2932003d5e4942386cef80913a13cef Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Thu, 11 Feb 2021 21:57:44 +0100 Subject: [PATCH 18/60] test for CRLF error (got lost) --- PRIVATE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PRIVATE b/PRIVATE index 91a4329a6..e74cf0062 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit 91a4329a6fe073fc2ef17e5c2c8e2f796e3b897b +Subproject commit e74cf00628285a587ced1e551cc9837c1011ca1c From 4515920b695e01aa6b0a343eb3ffa41887e7fc4d Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Thu, 11 Feb 2021 23:54:43 +0100 Subject: [PATCH 19/60] not needed --- src/homogenization.f90 | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/src/homogenization.f90 b/src/homogenization.f90 index 62ac52f06..14dd26726 100644 --- a/src/homogenization.f90 +++ b/src/homogenization.f90 @@ -311,26 +311,6 @@ subroutine materialpoint_stressAndItsTangent(dt,FEsolving_execIP,FEsolving_execE enddo !$OMP END DO -! !$OMP DO PRIVATE(ho,ph,ce) -! do el = FEsolving_execElem(1),FEsolving_execElem(2) -! if (terminallyIll) continue -! ho = material_homogenizationAt(el) -! do ip = FEsolving_execIP(1),FEsolving_execIP(2) -! ce = (el-1)*discretization_nIPs + ip -! call damage_partition(ce) -! do co = 1, homogenization_Nconstituents(ho) -! ph = material_phaseAt(co,el) -! if (.not. thermal_stress(dt,ph,material_phaseMemberAt(co,ip,el))) then -! if (.not. terminallyIll) & ! so first signals terminally ill... -! print*, ' Integration point ', ip,' at element ', el, ' terminally ill' -! terminallyIll = .true. ! ...and kills all others -! endif -! call thermal_homogenize(ip,el) -! enddo -! enddo -! enddo -! !$OMP END DO - !$OMP DO PRIVATE(ho) elementLooping3: do el = FEsolving_execElem(1),FEsolving_execElem(2) ho = material_homogenizationAt(el) From f6be3fe0b74be7b4ee2e3d728fee9b75d0327f42 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Fri, 12 Feb 2021 00:12:57 +0100 Subject: [PATCH 20/60] no need for pointer --- src/damage_none.f90 | 4 ---- src/damage_nonlocal.f90 | 2 -- src/homogenization_damage.f90 | 4 ++-- src/material.f90 | 6 ------ src/phase_damage_anisobrittle.f90 | 2 +- src/phase_damage_anisoductile.f90 | 2 +- src/phase_damage_isoductile.f90 | 2 +- src/phase_mechanical.f90 | 2 +- src/phase_mechanical_eigen_cleavageopening.f90 | 2 +- src/phase_mechanical_eigen_slipplaneopening.f90 | 2 +- 10 files changed, 8 insertions(+), 20 deletions(-) diff --git a/src/damage_none.f90 b/src/damage_none.f90 index 680110d55..c4b1c1589 100644 --- a/src/damage_none.f90 +++ b/src/damage_none.f90 @@ -3,8 +3,6 @@ !> @brief material subroutine for constant damage field !-------------------------------------------------------------------------------------------------- module damage_none - use prec - use config use material implicit none @@ -29,8 +27,6 @@ subroutine damage_none_init allocate(damageState_h(h)%state0 (0,Nmaterialpoints)) allocate(damageState_h(h)%state (0,Nmaterialpoints)) - allocate (damage(h)%p(Nmaterialpoints), source=1.0_pReal) - enddo end subroutine damage_none_init diff --git a/src/damage_nonlocal.f90 b/src/damage_nonlocal.f90 index 807231889..dd50cf4cf 100644 --- a/src/damage_nonlocal.f90 +++ b/src/damage_nonlocal.f90 @@ -57,8 +57,6 @@ subroutine damage_nonlocal_init allocate(damageState_h(h)%state0 (1,Nmaterialpoints), source=1.0_pReal) allocate(damageState_h(h)%state (1,Nmaterialpoints), source=1.0_pReal) - damage(h)%p => damageState_h(h)%state(1,:) - enddo end subroutine damage_nonlocal_init diff --git a/src/homogenization_damage.f90 b/src/homogenization_damage.f90 index 8b73ed54a..4f23af3be 100644 --- a/src/homogenization_damage.f90 +++ b/src/homogenization_damage.f90 @@ -143,7 +143,7 @@ module subroutine damage_nonlocal_putNonLocalDamage(phi,ip,el) homog = material_homogenizationAt(el) offset = material_homogenizationMemberAt(ip,el) - damage(homog)%p(offset) = phi + damagestate_h(homog)%state(1,offset) = phi end subroutine damage_nonlocal_putNonLocalDamage @@ -162,7 +162,7 @@ module subroutine damage_nonlocal_results(homog,group) outputsLoop: do o = 1,size(prm%output) select case(prm%output(o)) case ('phi') - call results_writeDataset(group,damage(homog)%p,prm%output(o),& + call results_writeDataset(group,damagestate_h(homog)%state(1,:),prm%output(o),& 'damage indicator','-') end select enddo outputsLoop diff --git a/src/material.f90 b/src/material.f90 index ccc6898be..3689cd0b0 100644 --- a/src/material.f90 +++ b/src/material.f90 @@ -70,9 +70,6 @@ module material type(Rotation), dimension(:,:,:), allocatable, public, protected :: & material_orientation0 !< initial orientation of each grain,IP,element - type(group_float), allocatable, dimension(:), public :: & - damage !< damage field - public :: & material_init, & THERMAL_ISOTHERMAL_ID, & @@ -105,9 +102,6 @@ subroutine material_init(restart) allocate(homogState (size(material_name_homogenization))) allocate(damageState_h (size(material_name_homogenization))) - allocate(damage (size(material_name_homogenization))) - - if (.not. restart) then call results_openJobFile call results_mapping_phase(material_phaseAt,material_phaseMemberAt,material_name_phase) diff --git a/src/phase_damage_anisobrittle.f90 b/src/phase_damage_anisobrittle.f90 index 51ca7786a..b328dfed7 100644 --- a/src/phase_damage_anisobrittle.f90 +++ b/src/phase_damage_anisobrittle.f90 @@ -152,7 +152,7 @@ module subroutine anisobrittle_dotState(S, co, ip, el) traction_t = math_tensordot(S,prm%cleavage_systems(1:3,1:3,2,i)) traction_n = math_tensordot(S,prm%cleavage_systems(1:3,1:3,3,i)) - traction_crit = prm%g_crit(i)*damage(homog)%p(damageOffset)**2.0_pReal + traction_crit = prm%g_crit(i)*damagestate_h(homog)%state(1,damageOffset)**2.0_pReal damageState(ph)%p(sourceOffset)%dotState(1,me) & = damageState(ph)%p(sourceOffset)%dotState(1,me) & diff --git a/src/phase_damage_anisoductile.f90 b/src/phase_damage_anisoductile.f90 index e54eff201..18c29fdfc 100644 --- a/src/phase_damage_anisoductile.f90 +++ b/src/phase_damage_anisoductile.f90 @@ -129,7 +129,7 @@ module subroutine anisoductile_dotState(co, ip, el) associate(prm => param(source_damage_anisoDuctile_instance(ph))) damageState(ph)%p(sourceOffset)%dotState(1,me) & - = sum(plasticState(ph)%slipRate(:,me)/(damage(homog)%p(damageOffset)**prm%q)/prm%gamma_crit) + = sum(plasticState(ph)%slipRate(:,me)/(damagestate_h(homog)%state(1,damageOffset)**prm%q)/prm%gamma_crit) end associate end subroutine anisoductile_dotState diff --git a/src/phase_damage_isoductile.f90 b/src/phase_damage_isoductile.f90 index 71f99078b..9dac17cd8 100644 --- a/src/phase_damage_isoductile.f90 +++ b/src/phase_damage_isoductile.f90 @@ -120,7 +120,7 @@ module subroutine isoductile_dotState(co, ip, el) associate(prm => param(source_damage_isoDuctile_instance(ph))) damageState(ph)%p(sourceOffset)%dotState(1,me) = & - sum(plasticState(ph)%slipRate(:,me))/(damage(homog)%p(damageOffset)**prm%q)/prm%gamma_crit + sum(plasticState(ph)%slipRate(:,me))/(damagestate_h(homog)%state(1,damageOffset)**prm%q)/prm%gamma_crit end associate end subroutine isoductile_dotState diff --git a/src/phase_mechanical.f90 b/src/phase_mechanical.f90 index efd4d51d2..f2f3333d3 100644 --- a/src/phase_mechanical.f90 +++ b/src/phase_mechanical.f90 @@ -381,7 +381,7 @@ subroutine phase_hooke_SandItsTangents(S, dS_dFe, dS_dFi, & DegradationLoop: do d = 1, phase_NstiffnessDegradations(material_phaseAt(co,el)) degradationType: select case(phase_stiffnessDegradation(d,material_phaseAt(co,el))) case (STIFFNESS_DEGRADATION_damage_ID) degradationType - C = C * damage(ho)%p(material_homogenizationMemberAt(ip,el))**2 + C = C * damagestate_h(ho)%state(1,material_homogenizationMemberAt(ip,el))**2 end select degradationType enddo DegradationLoop diff --git a/src/phase_mechanical_eigen_cleavageopening.f90 b/src/phase_mechanical_eigen_cleavageopening.f90 index 59be7837a..b41cb1e9c 100644 --- a/src/phase_mechanical_eigen_cleavageopening.f90 +++ b/src/phase_mechanical_eigen_cleavageopening.f90 @@ -126,7 +126,7 @@ module subroutine kinematics_cleavage_opening_LiAndItsTangent(Ld, dLd_dTstar, S, dLd_dTstar = 0.0_pReal associate(prm => param(kinematics_cleavage_opening_instance(material_phaseAt(co,el)))) do i = 1,prm%sum_N_cl - traction_crit = prm%g_crit(i)* damage(homog)%p(damageOffset)**2.0_pReal + traction_crit = prm%g_crit(i)*damagestate_h(homog)%state(1,damageOffset)**2.0_pReal traction_d = math_tensordot(S,prm%cleavage_systems(1:3,1:3,1,i)) if (abs(traction_d) > traction_crit + tol_math_check) then diff --git a/src/phase_mechanical_eigen_slipplaneopening.f90 b/src/phase_mechanical_eigen_slipplaneopening.f90 index a144d39a6..682f0b825 100644 --- a/src/phase_mechanical_eigen_slipplaneopening.f90 +++ b/src/phase_mechanical_eigen_slipplaneopening.f90 @@ -152,7 +152,7 @@ module subroutine kinematics_slipplane_opening_LiAndItsTangent(Ld, dLd_dTstar, S traction_t = math_tensordot(S,prm%P_t(1:3,1:3,i)) traction_n = math_tensordot(S,prm%P_n(1:3,1:3,i)) - traction_crit = prm%g_crit(i)* damage(homog)%p(damageOffset) ! degrading critical load carrying capacity by damage + traction_crit = prm%g_crit(i)* damagestate_h(homog)%state(1,damageOffset) ! degrading critical load carrying capacity by damage udotd = sign(1.0_pReal,traction_d)* prm%dot_o* ( abs(traction_d)/traction_crit & - abs(traction_d)/prm%g_crit(i))**prm%q From 462ca1a30b2893fb0897b26eb1eeb5ac95fbf07d Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Fri, 12 Feb 2021 08:10:25 +0100 Subject: [PATCH 21/60] not needed --- src/commercialFEM_fileList.f90 | 1 - src/damage_none.f90 | 34 ---------------------------------- src/homogenization.f90 | 2 -- 3 files changed, 37 deletions(-) delete mode 100644 src/damage_none.f90 diff --git a/src/commercialFEM_fileList.f90 b/src/commercialFEM_fileList.f90 index a191298a3..cf48e19ce 100644 --- a/src/commercialFEM_fileList.f90 +++ b/src/commercialFEM_fileList.f90 @@ -41,7 +41,6 @@ #include "phase_damage_isoductile.f90" #include "phase_damage_anisobrittle.f90" #include "phase_damage_anisoductile.f90" -#include "damage_none.f90" #include "damage_nonlocal.f90" #include "homogenization.f90" #include "homogenization_mechanical.f90" diff --git a/src/damage_none.f90 b/src/damage_none.f90 deleted file mode 100644 index c4b1c1589..000000000 --- a/src/damage_none.f90 +++ /dev/null @@ -1,34 +0,0 @@ -!-------------------------------------------------------------------------------------------------- -!> @author Pratheek Shanthraj, Max-Planck-Institut für Eisenforschung GmbH -!> @brief material subroutine for constant damage field -!-------------------------------------------------------------------------------------------------- -module damage_none - use material - - implicit none - public - -contains - -!-------------------------------------------------------------------------------------------------- -!> @brief allocates all neccessary fields, reads information from material configuration file -!-------------------------------------------------------------------------------------------------- -subroutine damage_none_init - - integer :: h,Nmaterialpoints - - print'(/,a)', ' <<<+- damage_none init -+>>>'; flush(6) - - do h = 1, size(material_name_homogenization) - if (damage_type(h) /= DAMAGE_NONE_ID) cycle - - Nmaterialpoints = count(material_homogenizationAt == h) - damageState_h(h)%sizeState = 0 - allocate(damageState_h(h)%state0 (0,Nmaterialpoints)) - allocate(damageState_h(h)%state (0,Nmaterialpoints)) - - enddo - -end subroutine damage_none_init - -end module damage_none diff --git a/src/homogenization.f90 b/src/homogenization.f90 index 14dd26726..87b15c43e 100644 --- a/src/homogenization.f90 +++ b/src/homogenization.f90 @@ -12,7 +12,6 @@ module homogenization use material use phase use discretization - use damage_none use damage_nonlocal use HDF5_utilities use results @@ -220,7 +219,6 @@ subroutine homogenization_init() call thermal_init() call damage_init() - if (any(damage_type == DAMAGE_none_ID)) call damage_none_init if (any(damage_type == DAMAGE_nonlocal_ID)) call damage_nonlocal_init From 7bec3e03630d8daa0c957b7cb5714fecf1274d5f Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Fri, 12 Feb 2021 09:31:02 +0100 Subject: [PATCH 22/60] use partitioned damage --- src/homogenization.f90 | 6 ++++-- src/homogenization_damage.f90 | 3 ++- src/material.f90 | 2 +- src/phase_damage_anisobrittle.f90 | 2 +- src/phase_damage_anisoductile.f90 | 2 +- src/phase_damage_isoductile.f90 | 2 +- src/phase_mechanical.f90 | 2 +- src/phase_mechanical_eigen_cleavageopening.f90 | 2 +- src/phase_mechanical_eigen_slipplaneopening.f90 | 2 +- 9 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/homogenization.f90 b/src/homogenization.f90 index 87b15c43e..3d0a4bb7a 100644 --- a/src/homogenization.f90 +++ b/src/homogenization.f90 @@ -219,7 +219,7 @@ subroutine homogenization_init() call thermal_init() call damage_init() - if (any(damage_type == DAMAGE_nonlocal_ID)) call damage_nonlocal_init + call damage_nonlocal_init end subroutine homogenization_init @@ -255,6 +255,7 @@ subroutine materialpoint_stressAndItsTangent(dt,FEsolving_execIP,FEsolving_execE if(homogState(ho)%sizeState > 0) homogState(ho)%State(:,me) = homogState(ho)%State0(:,me) if(damageState_h(ho)%sizeState > 0) damageState_h(ho)%State(:,me) = damageState_h(ho)%State0(:,me) + call damage_partition(ce) doneAndHappy = [.false.,.true.] @@ -375,7 +376,8 @@ subroutine homogenization_forward do ho = 1, size(material_name_homogenization) homogState (ho)%state0 = homogState (ho)%state - damageState_h(ho)%state0 = damageState_h(ho)%state + if(damageState_h(ho)%sizeState > 0) & + damageState_h(ho)%state0 = damageState_h(ho)%state enddo end subroutine homogenization_forward diff --git a/src/homogenization_damage.f90 b/src/homogenization_damage.f90 index 4f23af3be..502174309 100644 --- a/src/homogenization_damage.f90 +++ b/src/homogenization_damage.f90 @@ -72,7 +72,8 @@ module subroutine damage_partition(ce) integer :: co - phi = current(material_homogenizationAt2(ce))%phi(material_homogenizationMemberAt2(ce)) + if(damageState_h(material_homogenizationAt2(ce))%sizeState < 1) return + phi = damagestate_h(material_homogenizationAt2(ce))%state(1,material_homogenizationMemberAt2(ce)) do co = 1, homogenization_Nconstituents(material_homogenizationAt2(ce)) call phase_damage_set_phi(phi,co,ce) enddo diff --git a/src/material.f90 b/src/material.f90 index 3689cd0b0..b76b2b296 100644 --- a/src/material.f90 +++ b/src/material.f90 @@ -100,7 +100,7 @@ subroutine material_init(restart) allocate(homogState (size(material_name_homogenization))) - allocate(damageState_h (size(material_name_homogenization))) + allocate(damageState_h (size(material_name_homogenization))) if (.not. restart) then call results_openJobFile diff --git a/src/phase_damage_anisobrittle.f90 b/src/phase_damage_anisobrittle.f90 index b328dfed7..699e9508b 100644 --- a/src/phase_damage_anisobrittle.f90 +++ b/src/phase_damage_anisobrittle.f90 @@ -152,7 +152,7 @@ module subroutine anisobrittle_dotState(S, co, ip, el) traction_t = math_tensordot(S,prm%cleavage_systems(1:3,1:3,2,i)) traction_n = math_tensordot(S,prm%cleavage_systems(1:3,1:3,3,i)) - traction_crit = prm%g_crit(i)*damagestate_h(homog)%state(1,damageOffset)**2.0_pReal + traction_crit = prm%g_crit(i)*phase_damage_get_phi(co,ip,el)**2.0_pReal damageState(ph)%p(sourceOffset)%dotState(1,me) & = damageState(ph)%p(sourceOffset)%dotState(1,me) & diff --git a/src/phase_damage_anisoductile.f90 b/src/phase_damage_anisoductile.f90 index 18c29fdfc..b22f5b3d6 100644 --- a/src/phase_damage_anisoductile.f90 +++ b/src/phase_damage_anisoductile.f90 @@ -129,7 +129,7 @@ module subroutine anisoductile_dotState(co, ip, el) associate(prm => param(source_damage_anisoDuctile_instance(ph))) damageState(ph)%p(sourceOffset)%dotState(1,me) & - = sum(plasticState(ph)%slipRate(:,me)/(damagestate_h(homog)%state(1,damageOffset)**prm%q)/prm%gamma_crit) + = sum(plasticState(ph)%slipRate(:,me)/(phase_damage_get_phi(co,ip,el)**prm%q)/prm%gamma_crit) end associate end subroutine anisoductile_dotState diff --git a/src/phase_damage_isoductile.f90 b/src/phase_damage_isoductile.f90 index 9dac17cd8..e9aec1944 100644 --- a/src/phase_damage_isoductile.f90 +++ b/src/phase_damage_isoductile.f90 @@ -120,7 +120,7 @@ module subroutine isoductile_dotState(co, ip, el) associate(prm => param(source_damage_isoDuctile_instance(ph))) damageState(ph)%p(sourceOffset)%dotState(1,me) = & - sum(plasticState(ph)%slipRate(:,me))/(damagestate_h(homog)%state(1,damageOffset)**prm%q)/prm%gamma_crit + sum(plasticState(ph)%slipRate(:,me))/(phase_damage_get_phi(co,ip,el)**prm%q)/prm%gamma_crit end associate end subroutine isoductile_dotState diff --git a/src/phase_mechanical.f90 b/src/phase_mechanical.f90 index f2f3333d3..61151d33b 100644 --- a/src/phase_mechanical.f90 +++ b/src/phase_mechanical.f90 @@ -381,7 +381,7 @@ subroutine phase_hooke_SandItsTangents(S, dS_dFe, dS_dFi, & DegradationLoop: do d = 1, phase_NstiffnessDegradations(material_phaseAt(co,el)) degradationType: select case(phase_stiffnessDegradation(d,material_phaseAt(co,el))) case (STIFFNESS_DEGRADATION_damage_ID) degradationType - C = C * damagestate_h(ho)%state(1,material_homogenizationMemberAt(ip,el))**2 + C = C * phase_damage_get_phi(co,ip,el)**2 end select degradationType enddo DegradationLoop diff --git a/src/phase_mechanical_eigen_cleavageopening.f90 b/src/phase_mechanical_eigen_cleavageopening.f90 index b41cb1e9c..55102e196 100644 --- a/src/phase_mechanical_eigen_cleavageopening.f90 +++ b/src/phase_mechanical_eigen_cleavageopening.f90 @@ -126,7 +126,7 @@ module subroutine kinematics_cleavage_opening_LiAndItsTangent(Ld, dLd_dTstar, S, dLd_dTstar = 0.0_pReal associate(prm => param(kinematics_cleavage_opening_instance(material_phaseAt(co,el)))) do i = 1,prm%sum_N_cl - traction_crit = prm%g_crit(i)*damagestate_h(homog)%state(1,damageOffset)**2.0_pReal + traction_crit = prm%g_crit(i)*phase_damage_get_phi(co,ip,el)**2.0_pReal traction_d = math_tensordot(S,prm%cleavage_systems(1:3,1:3,1,i)) if (abs(traction_d) > traction_crit + tol_math_check) then diff --git a/src/phase_mechanical_eigen_slipplaneopening.f90 b/src/phase_mechanical_eigen_slipplaneopening.f90 index 682f0b825..cf5e918b3 100644 --- a/src/phase_mechanical_eigen_slipplaneopening.f90 +++ b/src/phase_mechanical_eigen_slipplaneopening.f90 @@ -152,7 +152,7 @@ module subroutine kinematics_slipplane_opening_LiAndItsTangent(Ld, dLd_dTstar, S traction_t = math_tensordot(S,prm%P_t(1:3,1:3,i)) traction_n = math_tensordot(S,prm%P_n(1:3,1:3,i)) - traction_crit = prm%g_crit(i)* damagestate_h(homog)%state(1,damageOffset) ! degrading critical load carrying capacity by damage + traction_crit = prm%g_crit(i)* phase_damage_get_phi(co,ip,el) ! degrading critical load carrying capacity by damage udotd = sign(1.0_pReal,traction_d)* prm%dot_o* ( abs(traction_d)/traction_crit & - abs(traction_d)/prm%g_crit(i))**prm%q From f1b8978e2107f058dcaebb299eb61ddde166a7ef Mon Sep 17 00:00:00 2001 From: Sharan Roongta Date: Wed, 10 Feb 2021 21:08:48 +0100 Subject: [PATCH 23/60] accept variables that will be used **kwargs allowed the use of extraneous arguments --- python/damask/_orientation.py | 101 ++++++++++++++++++++++++---------- python/damask/_rotation.py | 32 ++++------- 2 files changed, 82 insertions(+), 51 deletions(-) diff --git a/python/damask/_orientation.py b/python/damask/_orientation.py index cf31f4089..47334d555 100644 --- a/python/damask/_orientation.py +++ b/python/damask/_orientation.py @@ -1,3 +1,5 @@ +import inspect + import numpy as np from . import Rotation @@ -107,8 +109,7 @@ class Orientation(Rotation): lattice = None, a = None,b = None,c = None, alpha = None,beta = None,gamma = None, - degrees = False, - **kwargs): + degrees = False): """ Initialize orientation object. @@ -263,71 +264,111 @@ class Orientation(Rotation): raise TypeError('Use "O@b", i.e. matmul, to apply Orientation "O" to object "b"') + @staticmethod + def _separate_arguments(parent_dict,function): + """ + Separate arguments required by Rotation and Orientation objects respectively. + + Parameters + ---------- + parent_dict : Dictionary + Contains all **kwargs + function: Method + Function whose signature list is required + + Returns + ------- + ori_dict: dictionary + Dictionary consisting of valid keys accepted by Orientation class + rot_dict: dictionary + Dictionary consisting of valid keys accepted by 'function' in Rotation class + + """ + set_ori = set(inspect.signature(Orientation.__init__).parameters.keys()) & set(parent_dict.keys()) + set_rot = set(inspect.signature(function).parameters.keys()) & set(parent_dict.keys()) + ori_dict = {key: parent_dict[key] for key in set_ori} + rot_dict = {key: parent_dict[key] for key in set_rot} + if(set(parent_dict.keys())-(set_ori|set_rot)): + raise KeyError(f'Unknown key {set(parent_dict.keys())-(set_ori|set_rot)} present') + return rot_dict,ori_dict + + @classmethod @util.extended_docstring(Rotation.from_random,_parameter_doc) def from_random(cls,**kwargs): - return cls(rotation=Rotation.from_random(**kwargs),**kwargs) + kwargs_rot,kwargs_ori = Orientation._separate_arguments(kwargs,Rotation.from_random) + return cls(rotation=Rotation.from_random(**kwargs_rot),**kwargs_ori) @classmethod @util.extended_docstring(Rotation.from_quaternion,_parameter_doc) def from_quaternion(cls,**kwargs): - return cls(rotation=Rotation.from_quaternion(**kwargs),**kwargs) + kwargs_rot,kwargs_ori = Orientation._separate_arguments(kwargs,Rotation.from_quaternion) + return cls(rotation=Rotation.from_quaternion(**kwargs_rot),**kwargs_ori) @classmethod @util.extended_docstring(Rotation.from_Euler_angles,_parameter_doc) def from_Euler_angles(cls,**kwargs): - return cls(rotation=Rotation.from_Euler_angles(**kwargs),**kwargs) - - + kwargs_rot,kwargs_ori = Orientation._separate_arguments(kwargs,Rotation.from_Euler_angles) + return cls(rotation=Rotation.from_Euler_angles(**kwargs_rot),**kwargs_ori) + + @classmethod @util.extended_docstring(Rotation.from_axis_angle,_parameter_doc) def from_axis_angle(cls,**kwargs): - return cls(rotation=Rotation.from_axis_angle(**kwargs),**kwargs) - - + kwargs_rot,kwargs_ori = Orientation._separate_arguments(kwargs,Rotation.from_axis_angle) + return cls(rotation=Rotation.from_axis_angle(**kwargs_rot),**kwargs_ori) + + @classmethod @util.extended_docstring(Rotation.from_basis,_parameter_doc) def from_basis(cls,**kwargs): - return cls(rotation=Rotation.from_basis(**kwargs),**kwargs) - - + kwargs_rot,kwargs_ori = Orientation._separate_arguments(kwargs,Rotation.from_basis) + return cls(rotation=Rotation.from_basis(**kwargs_rot),**kwargs_ori) + + @classmethod @util.extended_docstring(Rotation.from_matrix,_parameter_doc) def from_matrix(cls,**kwargs): - return cls(rotation=Rotation.from_matrix(**kwargs),**kwargs) - - + kwargs_rot,kwargs_ori = Orientation._separate_arguments(kwargs,Rotation.from_matrix) + return cls(rotation=Rotation.from_matrix(**kwargs_rot),**kwargs_ori) + + @classmethod @util.extended_docstring(Rotation.from_Rodrigues_vector,_parameter_doc) def from_Rodrigues_vector(cls,**kwargs): - return cls(rotation=Rotation.from_Rodrigues_vector(**kwargs),**kwargs) - - + kwargs_rot,kwargs_ori = Orientation._separate_arguments(kwargs,Rotation.from_Rodrigues_vector) + return cls(rotation=Rotation.from_Rodrigues_vector(**kwargs_rot),**kwargs_ori) + + @classmethod @util.extended_docstring(Rotation.from_homochoric,_parameter_doc) def from_homochoric(cls,**kwargs): - return cls(rotation=Rotation.from_homochoric(**kwargs),**kwargs) - - + kwargs_rot,kwargs_ori = Orientation._separate_arguments(kwargs,Rotation.from_homochoric) + return cls(rotation=Rotation.from_homochoric(**kwargs_rot),**kwargs_ori) + + @classmethod @util.extended_docstring(Rotation.from_cubochoric,_parameter_doc) def from_cubochoric(cls,**kwargs): - return cls(rotation=Rotation.from_cubochoric(**kwargs),**kwargs) - - + kwargs_rot,kwargs_ori = Orientation._separate_arguments(kwargs,Rotation.from_cubochoric) + return cls(rotation=Rotation.from_cubochoric(**kwargs_rot),**kwargs_ori) + + @classmethod @util.extended_docstring(Rotation.from_spherical_component,_parameter_doc) def from_spherical_component(cls,**kwargs): - return cls(rotation=Rotation.from_spherical_component(**kwargs),**kwargs) - - + kwargs_rot,kwargs_ori = Orientation._separate_arguments(kwargs,Rotation.from_spherical_component) + return cls(rotation=Rotation.from_spherical_component(**kwargs_rot),**kwargs_ori) + + @classmethod @util.extended_docstring(Rotation.from_fiber_component,_parameter_doc) def from_fiber_component(cls,**kwargs): - return cls(rotation=Rotation.from_fiber_component(**kwargs),**kwargs) - + kwargs_rot,kwargs_ori = Orientation._separate_arguments(kwargs,Rotation.from_fiber_component) + return cls(rotation=Rotation.from_fiber_component(**kwargs_rot),**kwargs_ori) + @classmethod @util.extend_docstring(_parameter_doc) diff --git a/python/damask/_rotation.py b/python/damask/_rotation.py index 441fb5b01..389215798 100644 --- a/python/damask/_rotation.py +++ b/python/damask/_rotation.py @@ -514,8 +514,7 @@ class Rotation: @staticmethod def from_quaternion(q, accept_homomorph = False, - P = -1, - **kwargs): + P = -1): """ Initialize from quaternion. @@ -550,8 +549,7 @@ class Rotation: @staticmethod def from_Euler_angles(phi, - degrees = False, - **kwargs): + degrees = False): """ Initialize from Bunge-Euler angles. @@ -578,8 +576,7 @@ class Rotation: def from_axis_angle(axis_angle, degrees = False, normalize = False, - P = -1, - **kwargs): + P = -1): """ Initialize from Axis angle pair. @@ -616,8 +613,7 @@ class Rotation: @staticmethod def from_basis(basis, orthonormal = True, - reciprocal = False, - **kwargs): + reciprocal = False): """ Initialize from lattice basis vectors. @@ -651,7 +647,7 @@ class Rotation: return Rotation(Rotation._om2qu(om)) @staticmethod - def from_matrix(R,**kwargs): + def from_matrix(R): """ Initialize from rotation matrix. @@ -695,8 +691,7 @@ class Rotation: @staticmethod def from_Rodrigues_vector(rho, normalize = False, - P = -1, - **kwargs): + P = -1): """ Initialize from Rodrigues-Frank vector (angle separated from axis). @@ -727,8 +722,7 @@ class Rotation: @staticmethod def from_homochoric(h, - P = -1, - **kwargs): + P = -1): """ Initialize from homochoric vector. @@ -755,8 +749,7 @@ class Rotation: @staticmethod def from_cubochoric(c, - P = -1, - **kwargs): + P = -1): """ Initialize from cubochoric vector. @@ -784,8 +777,7 @@ class Rotation: @staticmethod def from_random(shape = None, - rng_seed = None, - **kwargs): + rng_seed = None): """ Draw random rotation. @@ -878,8 +870,7 @@ class Rotation: sigma, N = 500, degrees = True, - rng_seed = None, - **kwargs): + rng_seed = None): """ Calculate set of rotations with Gaussian distribution around center. @@ -915,8 +906,7 @@ class Rotation: sigma = 0.0, N = 500, degrees = True, - rng_seed = None, - **kwargs): + rng_seed = None): """ Calculate set of rotations with Gaussian distribution around direction. From 9e8a243d6f4596dce91b4bf76e2aaad4400beb41 Mon Sep 17 00:00:00 2001 From: Sharan Roongta Date: Fri, 12 Feb 2021 12:15:08 +0100 Subject: [PATCH 24/60] avoid name conflict with lattice parameter 'c' --- python/damask/_rotation.py | 12 ++++++------ python/tests/test_Orientation.py | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/python/damask/_rotation.py b/python/damask/_rotation.py index 389215798..4109c181e 100644 --- a/python/damask/_rotation.py +++ b/python/damask/_rotation.py @@ -502,8 +502,8 @@ class Rotation: Returns ------- - c : numpy.ndarray of shape (...,3) - Cubochoric vector: (c_1, c_2, c_3), max(c_i) < 1/2*π^(2/3). + x : numpy.ndarray of shape (...,3) + Cubochoric vector: (x_1, x_2, x_3), max(x_i) < 1/2*π^(2/3). """ return Rotation._qu2cu(self.quaternion) @@ -748,20 +748,20 @@ class Rotation: return Rotation(Rotation._ho2qu(ho)) @staticmethod - def from_cubochoric(c, + def from_cubochoric(x, P = -1): """ Initialize from cubochoric vector. Parameters ---------- - c : numpy.ndarray of shape (...,3) - Cubochoric vector: (c_1, c_2, c_3), max(c_i) < 1/2*π^(2/3). + x : numpy.ndarray of shape (...,3) + Cubochoric vector: (x_1, x_2, x_3), max(x_i) < 1/2*π^(2/3). P : int ∈ {-1,1}, optional Convention used. Defaults to -1. """ - cu = np.array(c,dtype=float) + cu = np.array(x,dtype=float) if cu.shape[:-2:-1] != (3,): raise ValueError('Invalid shape.') if abs(P) != 1: diff --git a/python/tests/test_Orientation.py b/python/tests/test_Orientation.py index 436b73c04..92c3f63ab 100644 --- a/python/tests/test_Orientation.py +++ b/python/tests/test_Orientation.py @@ -118,7 +118,7 @@ class TestOrientation: == np.eye(3)) def test_from_cubochoric(self): - assert np.all(Orientation.from_cubochoric(c=np.zeros(3),lattice='triclinic').as_matrix() + assert np.all(Orientation.from_cubochoric(x=np.zeros(3),lattice='triclinic').as_matrix() == np.eye(3)) def test_from_spherical_component(self): From a09989fe0b53946e7607a2ddb309db6af31c6bb4 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Fri, 12 Feb 2021 12:35:50 +0100 Subject: [PATCH 25/60] homogenized damage only needed in homogenization --- src/damage_nonlocal.f90 | 69 ----------------------------------- src/homogenization.f90 | 79 +++++++++++++++++++++++++++++++++++++++++ src/material.f90 | 7 ++-- 3 files changed, 81 insertions(+), 74 deletions(-) diff --git a/src/damage_nonlocal.f90 b/src/damage_nonlocal.f90 index dd50cf4cf..fab08d500 100644 --- a/src/damage_nonlocal.f90 +++ b/src/damage_nonlocal.f90 @@ -14,79 +14,10 @@ module damage_nonlocal implicit none private - type, private :: tNumerics - real(pReal) :: & - charLength !< characteristic length scale for gradient problems - end type tNumerics - type(tNumerics), private :: & - num - - public :: & - damage_nonlocal_init, & - damage_nonlocal_getDiffusion contains -!-------------------------------------------------------------------------------------------------- -!> @brief module initialization -!> @details reads in material parameters, allocates arrays, and does sanity checks -!-------------------------------------------------------------------------------------------------- -subroutine damage_nonlocal_init - - integer :: Ninstances,Nmaterialpoints,h - class(tNode), pointer :: & - num_generic, & - material_homogenization - - print'(/,a)', ' <<<+- damage_nonlocal init -+>>>'; flush(6) - -!------------------------------------------------------------------------------------ -! read numerics parameter - num_generic => config_numerics%get('generic',defaultVal= emptyDict) - num%charLength = num_generic%get_asFloat('charLength',defaultVal=1.0_pReal) - - Ninstances = count(damage_type == DAMAGE_nonlocal_ID) - - material_homogenization => config_material%get('homogenization') - do h = 1, material_homogenization%length - if (damage_type(h) /= DAMAGE_NONLOCAL_ID) cycle - - Nmaterialpoints = count(material_homogenizationAt == h) - damageState_h(h)%sizeState = 1 - allocate(damageState_h(h)%state0 (1,Nmaterialpoints), source=1.0_pReal) - allocate(damageState_h(h)%state (1,Nmaterialpoints), source=1.0_pReal) - - enddo - -end subroutine damage_nonlocal_init - - -!-------------------------------------------------------------------------------------------------- -!> @brief returns homogenized non local damage diffusion tensor in reference configuration -!-------------------------------------------------------------------------------------------------- -function damage_nonlocal_getDiffusion(ip,el) - - integer, intent(in) :: & - ip, & !< integration point number - el !< element number - real(pReal), dimension(3,3) :: & - damage_nonlocal_getDiffusion - integer :: & - homog, & - grain - - homog = material_homogenizationAt(el) - damage_nonlocal_getDiffusion = 0.0_pReal - do grain = 1, homogenization_Nconstituents(homog) - damage_nonlocal_getDiffusion = damage_nonlocal_getDiffusion + & - crystallite_push33ToRef(grain,ip,el,lattice_D(1:3,1:3,material_phaseAt(grain,el))) - enddo - - damage_nonlocal_getDiffusion = & - num%charLength**2*damage_nonlocal_getDiffusion/real(homogenization_Nconstituents(homog),pReal) - -end function damage_nonlocal_getDiffusion end module damage_nonlocal diff --git a/src/homogenization.f90 b/src/homogenization.f90 index 3d0a4bb7a..36c03a314 100644 --- a/src/homogenization.f90 +++ b/src/homogenization.f90 @@ -15,10 +15,20 @@ module homogenization use damage_nonlocal use HDF5_utilities use results + use lattice implicit none private + type, private :: tNumerics_damage + real(pReal) :: & + charLength !< characteristic length scale for gradient problems + end type tNumerics_damage + + type(tNumerics_damage), private :: & + num_damage + + logical, public :: & terminallyIll = .false. !< at least one material point is terminally ill @@ -194,6 +204,10 @@ module homogenization homogenization_restartRead, & homogenization_restartWrite + public :: & + damage_nonlocal_init, & + damage_nonlocal_getDiffusion + contains @@ -208,6 +222,9 @@ subroutine homogenization_init() print'(/,a)', ' <<<+- homogenization init -+>>>'; flush(IO_STDOUT) + call material_parseHomogenization + print*, 'Homogenization parsed' + num_homog => config_numerics%get('homogenization',defaultVal=emptyDict) num_homogGeneric => num_homog%get('generic',defaultVal=emptyDict) @@ -437,4 +454,66 @@ subroutine homogenization_restartRead(fileHandle) end subroutine homogenization_restartRead + +!-------------------------------------------------------------------------------------------------- +!> @brief module initialization +!> @details reads in material parameters, allocates arrays, and does sanity checks +!-------------------------------------------------------------------------------------------------- +subroutine damage_nonlocal_init + + integer :: Ninstances,Nmaterialpoints,h + class(tNode), pointer :: & + num_generic, & + material_homogenization + + print'(/,a)', ' <<<+- damage_nonlocal init -+>>>'; flush(6) + +!------------------------------------------------------------------------------------ +! read numerics parameter + num_generic => config_numerics%get('generic',defaultVal= emptyDict) + num_damage%charLength = num_generic%get_asFloat('charLength',defaultVal=1.0_pReal) + + Ninstances = count(damage_type == DAMAGE_nonlocal_ID) + + material_homogenization => config_material%get('homogenization') + do h = 1, material_homogenization%length + if (damage_type(h) /= DAMAGE_NONLOCAL_ID) cycle + + Nmaterialpoints = count(material_homogenizationAt == h) + damageState_h(h)%sizeState = 1 + allocate(damageState_h(h)%state0 (1,Nmaterialpoints), source=1.0_pReal) + allocate(damageState_h(h)%state (1,Nmaterialpoints), source=1.0_pReal) + + enddo + +end subroutine damage_nonlocal_init + + +!-------------------------------------------------------------------------------------------------- +!> @brief returns homogenized non local damage diffusion tensor in reference configuration +!-------------------------------------------------------------------------------------------------- +function damage_nonlocal_getDiffusion(ip,el) + + integer, intent(in) :: & + ip, & !< integration point number + el !< element number + real(pReal), dimension(3,3) :: & + damage_nonlocal_getDiffusion + integer :: & + homog, & + grain + + homog = material_homogenizationAt(el) + damage_nonlocal_getDiffusion = 0.0_pReal + do grain = 1, homogenization_Nconstituents(homog) + damage_nonlocal_getDiffusion = damage_nonlocal_getDiffusion + & + crystallite_push33ToRef(grain,ip,el,lattice_D(1:3,1:3,material_phaseAt(grain,el))) + enddo + + damage_nonlocal_getDiffusion = & + num_damage%charLength**2*damage_nonlocal_getDiffusion/real(homogenization_Nconstituents(homog),pReal) + +end function damage_nonlocal_getDiffusion + + end module homogenization diff --git a/src/material.f90 b/src/material.f90 index b76b2b296..1c8292e5f 100644 --- a/src/material.f90 +++ b/src/material.f90 @@ -78,7 +78,8 @@ module material DAMAGE_NONLOCAL_ID, & HOMOGENIZATION_NONE_ID, & HOMOGENIZATION_ISOSTRAIN_ID, & - HOMOGENIZATION_RGC_ID + HOMOGENIZATION_RGC_ID, & + material_parseHomogenization contains @@ -95,10 +96,6 @@ subroutine material_init(restart) call material_parseMaterial print*, 'Material parsed' - call material_parseHomogenization - print*, 'Homogenization parsed' - - allocate(homogState (size(material_name_homogenization))) allocate(damageState_h (size(material_name_homogenization))) From 4eb2a981cab505e3a53be2a907d9e7d4aa3bf204 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Fri, 12 Feb 2021 15:31:43 +0100 Subject: [PATCH 26/60] keeping variables local --- src/commercialFEM_fileList.f90 | 1 - src/damage_nonlocal.f90 | 23 ------ src/grid/grid_damage_spectral.f90 | 1 - src/homogenization.f90 | 116 +++++++++++++++++++++++++++- src/homogenization_mechanical.f90 | 4 +- src/material.f90 | 123 ++---------------------------- 6 files changed, 120 insertions(+), 148 deletions(-) delete mode 100644 src/damage_nonlocal.f90 diff --git a/src/commercialFEM_fileList.f90 b/src/commercialFEM_fileList.f90 index cf48e19ce..97e7520f9 100644 --- a/src/commercialFEM_fileList.f90 +++ b/src/commercialFEM_fileList.f90 @@ -41,7 +41,6 @@ #include "phase_damage_isoductile.f90" #include "phase_damage_anisobrittle.f90" #include "phase_damage_anisoductile.f90" -#include "damage_nonlocal.f90" #include "homogenization.f90" #include "homogenization_mechanical.f90" #include "homogenization_mechanical_pass.f90" diff --git a/src/damage_nonlocal.f90 b/src/damage_nonlocal.f90 deleted file mode 100644 index fab08d500..000000000 --- a/src/damage_nonlocal.f90 +++ /dev/null @@ -1,23 +0,0 @@ -!-------------------------------------------------------------------------------------------------- -!> @author Pratheek Shanthraj, Max-Planck-Institut für Eisenforschung GmbH -!> @brief material subroutine for non-locally evolving damage field -!-------------------------------------------------------------------------------------------------- -module damage_nonlocal - use prec - use material - use config - use YAML_types - use lattice - use phase - use results - - implicit none - private - - - -contains - - - -end module damage_nonlocal diff --git a/src/grid/grid_damage_spectral.f90 b/src/grid/grid_damage_spectral.f90 index dc78d9e44..afbae027f 100644 --- a/src/grid/grid_damage_spectral.f90 +++ b/src/grid/grid_damage_spectral.f90 @@ -15,7 +15,6 @@ module grid_damage_spectral use IO use spectral_utilities use discretization_grid - use damage_nonlocal use YAML_types use homogenization use config diff --git a/src/homogenization.f90 b/src/homogenization.f90 index 36c03a314..073482c9a 100644 --- a/src/homogenization.f90 +++ b/src/homogenization.f90 @@ -12,7 +12,6 @@ module homogenization use material use phase use discretization - use damage_nonlocal use HDF5_utilities use results use lattice @@ -20,6 +19,37 @@ module homogenization implicit none private + + enum, bind(c); enumerator :: & + THERMAL_ISOTHERMAL_ID, & + THERMAL_CONDUCTION_ID, & + DAMAGE_NONE_ID, & + DAMAGE_NONLOCAL_ID, & + HOMOGENIZATION_UNDEFINED_ID, & + HOMOGENIZATION_NONE_ID, & + HOMOGENIZATION_ISOSTRAIN_ID, & + HOMOGENIZATION_RGC_ID + end enum + + type(tState), allocatable, dimension(:), public :: & + homogState, & + damageState_h + + integer, dimension(:), allocatable, public, protected :: & + homogenization_typeInstance, & !< instance of particular type of each homogenization + thermal_typeInstance, & !< instance of particular type of each thermal transport + damage_typeInstance !< instance of particular type of each nonlocal damage + + real(pReal), dimension(:), allocatable, public, protected :: & + thermal_initialT + + integer(kind(THERMAL_isothermal_ID)), dimension(:), allocatable, public, protected :: & + thermal_type !< thermal transport model + integer(kind(DAMAGE_none_ID)), dimension(:), allocatable, public, protected :: & + damage_type !< nonlocal damage model + integer(kind(HOMOGENIZATION_undefined_ID)), dimension(:), allocatable, public, protected :: & + homogenization_type !< type of each homogenization + type, private :: tNumerics_damage real(pReal) :: & charLength !< characteristic length scale for gradient problems @@ -202,7 +232,9 @@ module homogenization homogenization_forward, & homogenization_results, & homogenization_restartRead, & - homogenization_restartWrite + homogenization_restartWrite, & + THERMAL_CONDUCTION_ID, & + DAMAGE_NONLOCAL_ID public :: & damage_nonlocal_init, & @@ -222,6 +254,9 @@ subroutine homogenization_init() print'(/,a)', ' <<<+- homogenization init -+>>>'; flush(IO_STDOUT) + + allocate(homogState (size(material_name_homogenization))) + allocate(damageState_h (size(material_name_homogenization))) call material_parseHomogenization print*, 'Homogenization parsed' @@ -516,4 +551,81 @@ function damage_nonlocal_getDiffusion(ip,el) end function damage_nonlocal_getDiffusion +!-------------------------------------------------------------------------------------------------- +!> @brief parses the homogenization part from the material configuration +! ToDo: This should be done in homogenization +!-------------------------------------------------------------------------------------------------- +subroutine material_parseHomogenization + + class(tNode), pointer :: & + material_homogenization, & + homog, & + homogMech, & + homogThermal, & + homogDamage + + integer :: h + + material_homogenization => config_material%get('homogenization') + + allocate(homogenization_type(size(material_name_homogenization)), source=HOMOGENIZATION_undefined_ID) + allocate(thermal_type(size(material_name_homogenization)), source=THERMAL_isothermal_ID) + allocate(damage_type (size(material_name_homogenization)), source=DAMAGE_none_ID) + allocate(homogenization_typeInstance(size(material_name_homogenization)), source=0) + allocate(thermal_typeInstance(size(material_name_homogenization)), source=0) + allocate(damage_typeInstance(size(material_name_homogenization)), source=0) + allocate(thermal_initialT(size(material_name_homogenization)), source=300.0_pReal) + + do h=1, size(material_name_homogenization) + homog => material_homogenization%get(h) + homogMech => homog%get('mechanics') + select case (homogMech%get_asString('type')) + case('pass') + homogenization_type(h) = HOMOGENIZATION_NONE_ID + case('isostrain') + homogenization_type(h) = HOMOGENIZATION_ISOSTRAIN_ID + case('RGC') + homogenization_type(h) = HOMOGENIZATION_RGC_ID + case default + call IO_error(500,ext_msg=homogMech%get_asString('type')) + end select + + homogenization_typeInstance(h) = count(homogenization_type==homogenization_type(h)) + + if(homog%contains('thermal')) then + homogThermal => homog%get('thermal') + thermal_initialT(h) = homogThermal%get_asFloat('T_0',defaultVal=300.0_pReal) + + select case (homogThermal%get_asString('type')) + case('isothermal') + thermal_type(h) = THERMAL_isothermal_ID + case('conduction') + thermal_type(h) = THERMAL_conduction_ID + case default + call IO_error(500,ext_msg=homogThermal%get_asString('type')) + end select + endif + + if(homog%contains('damage')) then + homogDamage => homog%get('damage') + select case (homogDamage%get_asString('type')) + case('none') + damage_type(h) = DAMAGE_none_ID + case('nonlocal') + damage_type(h) = DAMAGE_nonlocal_ID + case default + call IO_error(500,ext_msg=homogDamage%get_asString('type')) + end select + endif + enddo + + do h=1, size(material_name_homogenization) + homogenization_typeInstance(h) = count(homogenization_type(1:h) == homogenization_type(h)) + thermal_typeInstance(h) = count(thermal_type (1:h) == thermal_type (h)) + damage_typeInstance(h) = count(damage_type (1:h) == damage_type (h)) + enddo + +end subroutine material_parseHomogenization + + end module homogenization diff --git a/src/homogenization_mechanical.f90 b/src/homogenization_mechanical.f90 index 91e1d3d84..c05b576da 100644 --- a/src/homogenization_mechanical.f90 +++ b/src/homogenization_mechanical.f90 @@ -225,8 +225,6 @@ end function mechanical_updateState !> @brief Write results to file. !-------------------------------------------------------------------------------------------------- module subroutine mechanical_results(group_base,h) - use material, only: & - material_homogenization_type => homogenization_type character(len=*), intent(in) :: group_base integer, intent(in) :: h @@ -236,7 +234,7 @@ module subroutine mechanical_results(group_base,h) group = trim(group_base)//'/mech' call results_closeGroup(results_addGroup(group)) - select case(material_homogenization_type(h)) + select case(homogenization_type(h)) case(HOMOGENIZATION_rgc_ID) call mechanical_RGC_results(homogenization_typeInstance(h),group) diff --git a/src/material.f90 b/src/material.f90 index 1c8292e5f..df6dc6dd1 100644 --- a/src/material.f90 +++ b/src/material.f90 @@ -6,50 +6,26 @@ !-------------------------------------------------------------------------------------------------- module material use prec - use math use config use results use IO use rotations use discretization + use YAML_types implicit none private - enum, bind(c); enumerator :: & - THERMAL_ISOTHERMAL_ID, & - THERMAL_CONDUCTION_ID, & - DAMAGE_NONE_ID, & - DAMAGE_NONLOCAL_ID, & - HOMOGENIZATION_UNDEFINED_ID, & - HOMOGENIZATION_NONE_ID, & - HOMOGENIZATION_ISOSTRAIN_ID, & - HOMOGENIZATION_RGC_ID - end enum + integer, dimension(:), allocatable, public, protected :: & + homogenization_Nconstituents !< number of grains in each homogenization character(len=:), public, protected, allocatable, dimension(:) :: & material_name_phase, & !< name of each phase material_name_homogenization !< name of each homogenization - integer(kind(THERMAL_isothermal_ID)), dimension(:), allocatable, public, protected :: & - thermal_type !< thermal transport model - integer(kind(DAMAGE_none_ID)), dimension(:), allocatable, public, protected :: & - damage_type !< nonlocal damage model - integer(kind(HOMOGENIZATION_undefined_ID)), dimension(:), allocatable, public, protected :: & - homogenization_type !< type of each homogenization - integer, public, protected :: & homogenization_maxNconstituents !< max number of grains in any USED homogenization - integer, dimension(:), allocatable, public, protected :: & - homogenization_Nconstituents, & !< number of grains in each homogenization - homogenization_typeInstance, & !< instance of particular type of each homogenization - thermal_typeInstance, & !< instance of particular type of each thermal transport - damage_typeInstance !< instance of particular type of each nonlocal damage - - real(pReal), dimension(:), allocatable, public, protected :: & - thermal_initialT !< initial temperature per each homogenization - integer, dimension(:), allocatable, public, protected :: & ! (elem) material_homogenizationAt, & !< homogenization ID of each element material_homogenizationAt2, & !< per cell @@ -63,23 +39,11 @@ module material integer, dimension(:,:,:), allocatable, public, protected :: & ! (constituent,IP,elem) material_phaseMemberAt !< position of the element within its phase instance - type(tState), allocatable, dimension(:), public :: & - homogState, & - damageState_h - type(Rotation), dimension(:,:,:), allocatable, public, protected :: & material_orientation0 !< initial orientation of each grain,IP,element public :: & - material_init, & - THERMAL_ISOTHERMAL_ID, & - THERMAL_CONDUCTION_ID, & - DAMAGE_NONE_ID, & - DAMAGE_NONLOCAL_ID, & - HOMOGENIZATION_NONE_ID, & - HOMOGENIZATION_ISOSTRAIN_ID, & - HOMOGENIZATION_RGC_ID, & - material_parseHomogenization + material_init contains @@ -90,14 +54,13 @@ subroutine material_init(restart) logical, intent(in) :: restart + print'(/,a)', ' <<<+- material init -+>>>'; flush(IO_STDOUT) call material_parseMaterial print*, 'Material parsed' - allocate(homogState (size(material_name_homogenization))) - allocate(damageState_h (size(material_name_homogenization))) if (.not. restart) then call results_openJobFile @@ -109,82 +72,6 @@ subroutine material_init(restart) end subroutine material_init -!-------------------------------------------------------------------------------------------------- -!> @brief parses the homogenization part from the material configuration -! ToDo: This should be done in homogenization -!-------------------------------------------------------------------------------------------------- -subroutine material_parseHomogenization - - class(tNode), pointer :: & - material_homogenization, & - homog, & - homogMech, & - homogThermal, & - homogDamage - - integer :: h - - material_homogenization => config_material%get('homogenization') - - allocate(homogenization_type(size(material_name_homogenization)), source=HOMOGENIZATION_undefined_ID) - allocate(thermal_type(size(material_name_homogenization)), source=THERMAL_isothermal_ID) - allocate(damage_type (size(material_name_homogenization)), source=DAMAGE_none_ID) - allocate(homogenization_typeInstance(size(material_name_homogenization)), source=0) - allocate(thermal_typeInstance(size(material_name_homogenization)), source=0) - allocate(damage_typeInstance(size(material_name_homogenization)), source=0) - allocate(thermal_initialT(size(material_name_homogenization)), source=300.0_pReal) - - do h=1, size(material_name_homogenization) - homog => material_homogenization%get(h) - homogMech => homog%get('mechanics') - select case (homogMech%get_asString('type')) - case('pass') - homogenization_type(h) = HOMOGENIZATION_NONE_ID - case('isostrain') - homogenization_type(h) = HOMOGENIZATION_ISOSTRAIN_ID - case('RGC') - homogenization_type(h) = HOMOGENIZATION_RGC_ID - case default - call IO_error(500,ext_msg=homogMech%get_asString('type')) - end select - - homogenization_typeInstance(h) = count(homogenization_type==homogenization_type(h)) - - if(homog%contains('thermal')) then - homogThermal => homog%get('thermal') - thermal_initialT(h) = homogThermal%get_asFloat('T_0',defaultVal=300.0_pReal) - - select case (homogThermal%get_asString('type')) - case('isothermal') - thermal_type(h) = THERMAL_isothermal_ID - case('conduction') - thermal_type(h) = THERMAL_conduction_ID - case default - call IO_error(500,ext_msg=homogThermal%get_asString('type')) - end select - endif - - if(homog%contains('damage')) then - homogDamage => homog%get('damage') - select case (homogDamage%get_asString('type')) - case('none') - damage_type(h) = DAMAGE_none_ID - case('nonlocal') - damage_type(h) = DAMAGE_nonlocal_ID - case default - call IO_error(500,ext_msg=homogDamage%get_asString('type')) - end select - endif - enddo - - do h=1, size(material_name_homogenization) - homogenization_typeInstance(h) = count(homogenization_type(1:h) == homogenization_type(h)) - thermal_typeInstance(h) = count(thermal_type (1:h) == thermal_type (h)) - damage_typeInstance(h) = count(damage_type (1:h) == damage_type (h)) - enddo - -end subroutine material_parseHomogenization - !-------------------------------------------------------------------------------------------------- !> @brief parses the material part in the material configuration file From fe63adcca4cbcb2e1c207a3e9e093f0762bae3bb Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Fri, 12 Feb 2021 17:04:35 +0100 Subject: [PATCH 27/60] mimic python error message and ensure that error is raised --- python/damask/_orientation.py | 49 +++++++++++++++++--------------- python/tests/test_Orientation.py | 17 ++++++++++- 2 files changed, 42 insertions(+), 24 deletions(-) diff --git a/python/damask/_orientation.py b/python/damask/_orientation.py index 47334d555..f01156903 100644 --- a/python/damask/_orientation.py +++ b/python/damask/_orientation.py @@ -268,30 +268,33 @@ class Orientation(Rotation): def _separate_arguments(parent_dict,function): """ Separate arguments required by Rotation and Orientation objects respectively. - + Parameters ---------- parent_dict : Dictionary Contains all **kwargs function: Method Function whose signature list is required - + Returns ------- ori_dict: dictionary Dictionary consisting of valid keys accepted by Orientation class rot_dict: dictionary Dictionary consisting of valid keys accepted by 'function' in Rotation class - + """ set_ori = set(inspect.signature(Orientation.__init__).parameters.keys()) & set(parent_dict.keys()) set_rot = set(inspect.signature(function).parameters.keys()) & set(parent_dict.keys()) ori_dict = {key: parent_dict[key] for key in set_ori} rot_dict = {key: parent_dict[key] for key in set_rot} - if(set(parent_dict.keys())-(set_ori|set_rot)): - raise KeyError(f'Unknown key {set(parent_dict.keys())-(set_ori|set_rot)} present') + + invalid_keys = set(parent_dict.keys())-(set_ori|set_rot) + if invalid_keys: + raise TypeError(f"{inspect.stack()[1][3]}() got an unexpected keyword argument '{invalid_keys.pop()}'") + return rot_dict,ori_dict - + @classmethod @util.extended_docstring(Rotation.from_random,_parameter_doc) @@ -312,63 +315,63 @@ class Orientation(Rotation): def from_Euler_angles(cls,**kwargs): kwargs_rot,kwargs_ori = Orientation._separate_arguments(kwargs,Rotation.from_Euler_angles) return cls(rotation=Rotation.from_Euler_angles(**kwargs_rot),**kwargs_ori) - - + + @classmethod @util.extended_docstring(Rotation.from_axis_angle,_parameter_doc) def from_axis_angle(cls,**kwargs): kwargs_rot,kwargs_ori = Orientation._separate_arguments(kwargs,Rotation.from_axis_angle) return cls(rotation=Rotation.from_axis_angle(**kwargs_rot),**kwargs_ori) - - + + @classmethod @util.extended_docstring(Rotation.from_basis,_parameter_doc) def from_basis(cls,**kwargs): kwargs_rot,kwargs_ori = Orientation._separate_arguments(kwargs,Rotation.from_basis) return cls(rotation=Rotation.from_basis(**kwargs_rot),**kwargs_ori) - - + + @classmethod @util.extended_docstring(Rotation.from_matrix,_parameter_doc) def from_matrix(cls,**kwargs): kwargs_rot,kwargs_ori = Orientation._separate_arguments(kwargs,Rotation.from_matrix) return cls(rotation=Rotation.from_matrix(**kwargs_rot),**kwargs_ori) - - + + @classmethod @util.extended_docstring(Rotation.from_Rodrigues_vector,_parameter_doc) def from_Rodrigues_vector(cls,**kwargs): kwargs_rot,kwargs_ori = Orientation._separate_arguments(kwargs,Rotation.from_Rodrigues_vector) return cls(rotation=Rotation.from_Rodrigues_vector(**kwargs_rot),**kwargs_ori) - - + + @classmethod @util.extended_docstring(Rotation.from_homochoric,_parameter_doc) def from_homochoric(cls,**kwargs): kwargs_rot,kwargs_ori = Orientation._separate_arguments(kwargs,Rotation.from_homochoric) return cls(rotation=Rotation.from_homochoric(**kwargs_rot),**kwargs_ori) - - + + @classmethod @util.extended_docstring(Rotation.from_cubochoric,_parameter_doc) def from_cubochoric(cls,**kwargs): kwargs_rot,kwargs_ori = Orientation._separate_arguments(kwargs,Rotation.from_cubochoric) return cls(rotation=Rotation.from_cubochoric(**kwargs_rot),**kwargs_ori) - - + + @classmethod @util.extended_docstring(Rotation.from_spherical_component,_parameter_doc) def from_spherical_component(cls,**kwargs): kwargs_rot,kwargs_ori = Orientation._separate_arguments(kwargs,Rotation.from_spherical_component) return cls(rotation=Rotation.from_spherical_component(**kwargs_rot),**kwargs_ori) - - + + @classmethod @util.extended_docstring(Rotation.from_fiber_component,_parameter_doc) def from_fiber_component(cls,**kwargs): kwargs_rot,kwargs_ori = Orientation._separate_arguments(kwargs,Rotation.from_fiber_component) return cls(rotation=Rotation.from_fiber_component(**kwargs_rot),**kwargs_ori) - + @classmethod @util.extend_docstring(_parameter_doc) diff --git a/python/tests/test_Orientation.py b/python/tests/test_Orientation.py index 92c3f63ab..e4174f795 100644 --- a/python/tests/test_Orientation.py +++ b/python/tests/test_Orientation.py @@ -141,7 +141,7 @@ class TestOrientation: dict(lattice='hP',a=1.0 ), dict(lattice='cI',a=1.0, ), ]) - def test_from_direction(self,kwargs): + def test_from_directions(self,kwargs): for a,b in np.random.random((10,2,3)): c = np.cross(b,a) if np.all(np.isclose(c,0)): continue @@ -151,6 +151,21 @@ class TestOrientation: assert np.isclose(np.dot(x/np.linalg.norm(x),np.array([1,0,0])),1) \ and np.isclose(np.dot(z/np.linalg.norm(z),np.array([0,0,1])),1) + @pytest.mark.parametrize('function',[Orientation.from_random, + Orientation.from_quaternion, + Orientation.from_Euler_angles, + Orientation.from_axis_angle, + Orientation.from_basis, + Orientation.from_matrix, + Orientation.from_Rodrigues_vector, + Orientation.from_homochoric, + Orientation.from_cubochoric, + Orientation.from_spherical_component, + Orientation.from_fiber_component, + Orientation.from_directions]) + def test_invalid_from(self,function): + with pytest.raises(TypeError): + function(c=.1,degrees=True,invalid=66) def test_negative_angle(self): with pytest.raises(ValueError): From 26768375781c781db96ab3e0c1f425becf835411 Mon Sep 17 00:00:00 2001 From: Test User Date: Fri, 12 Feb 2021 22:30:53 +0100 Subject: [PATCH 28/60] [skip ci] updated version information after successful test of v3.0.0-alpha2-428-gb7b764ab5 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index a1f129287..ce989b710 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v3.0.0-alpha2-421-ge96352b0e +v3.0.0-alpha2-428-gb7b764ab5 From 830d00fa675b960c6d5225638c48585915e2c04b Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Fri, 12 Feb 2021 22:41:35 +0100 Subject: [PATCH 29/60] simplified structure choice of damage model triggers eigendeformation, no repeated variables This implementation is the most ugly hack I could imagine. I just serves the purpose of having a stable material.yaml --- PRIVATE | 2 +- src/phase_damage.f90 | 4 +- src/phase_damage_anisobrittle.f90 | 4 +- src/phase_damage_isobrittle.f90 | 4 +- src/phase_damage_isoductile.f90 | 4 +- src/phase_mechanical_eigen.f90 | 44 ++++++++++++++++++- ...phase_mechanical_eigen_cleavageopening.f90 | 4 +- ...hase_mechanical_eigen_slipplaneopening.f90 | 4 +- 8 files changed, 55 insertions(+), 15 deletions(-) diff --git a/PRIVATE b/PRIVATE index e74cf0062..07d125fe4 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit e74cf00628285a587ced1e551cc9837c1011ca1c +Subproject commit 07d125fe476621224d9f2ef73b0cf88f3b07bc60 diff --git a/src/phase_damage.f90 b/src/phase_damage.f90 index 57145c550..6063f3583 100644 --- a/src/phase_damage.f90 +++ b/src/phase_damage.f90 @@ -175,7 +175,7 @@ module subroutine damage_init allocate(current(ph)%d_phi_d_dot_phi(Nconstituents),source=0.0_pReal) phase => phases%get(ph) - sources => phase%get('source',defaultVal=emptyList) + sources => phase%get('damage',defaultVal=emptyList) phase_Nsources(ph) = sources%length allocate(damageState(ph)%p(phase_Nsources(ph))) enddo @@ -493,7 +493,7 @@ function source_active(source_label,src_length) result(active_source) allocate(active_source(src_length,phases%length), source = .false. ) do p = 1, phases%length phase => phases%get(p) - sources => phase%get('source',defaultVal=emptyList) + sources => phase%get('damage',defaultVal=emptyList) do s = 1, sources%length src => sources%get(s) if(src%get_asString('type') == source_label) active_source(s,p) = .true. diff --git a/src/phase_damage_anisobrittle.f90 b/src/phase_damage_anisobrittle.f90 index 699e9508b..ad7f80604 100644 --- a/src/phase_damage_anisobrittle.f90 +++ b/src/phase_damage_anisobrittle.f90 @@ -51,7 +51,7 @@ module function anisobrittle_init(source_length) result(mySources) print'(/,a)', ' <<<+- phase:damage:anisobrittle init -+>>>' - mySources = source_active('damage_anisoBrittle',source_length) + mySources = source_active('anisobrittle',source_length) Ninstances = count(mySources) print'(a,i2)', ' # instances: ',Ninstances; flush(IO_STDOUT) if(Ninstances == 0) return @@ -65,7 +65,7 @@ module function anisobrittle_init(source_length) result(mySources) phase => phases%get(p) if(any(mySources(:,p))) source_damage_anisoBrittle_instance(p) = count(mySources(:,1:p)) if(count(mySources(:,p)) == 0) cycle - sources => phase%get('source') + sources => phase%get('damage') do sourceOffset = 1, sources%length if(mySources(sourceOffset,p)) then source_damage_anisoBrittle_offset(p) = sourceOffset diff --git a/src/phase_damage_isobrittle.f90 b/src/phase_damage_isobrittle.f90 index 529ecd404..a2ae7dfb7 100644 --- a/src/phase_damage_isobrittle.f90 +++ b/src/phase_damage_isobrittle.f90 @@ -41,7 +41,7 @@ module function isobrittle_init(source_length) result(mySources) print'(/,a)', ' <<<+- phase:damage:isobrittle init -+>>>' - mySources = source_active('damage_isoBrittle',source_length) + mySources = source_active('isobrittle',source_length) Ninstances = count(mySources) print'(a,i2)', ' # instances: ',Ninstances; flush(IO_STDOUT) if(Ninstances == 0) return @@ -55,7 +55,7 @@ module function isobrittle_init(source_length) result(mySources) phase => phases%get(p) if(any(mySources(:,p))) source_damage_isoBrittle_instance(p) = count(mySources(:,1:p)) if(count(mySources(:,p)) == 0) cycle - sources => phase%get('source') + sources => phase%get('damage') do sourceOffset = 1, sources%length if(mySources(sourceOffset,p)) then source_damage_isoBrittle_offset(p) = sourceOffset diff --git a/src/phase_damage_isoductile.f90 b/src/phase_damage_isoductile.f90 index e9aec1944..f378b7ad2 100644 --- a/src/phase_damage_isoductile.f90 +++ b/src/phase_damage_isoductile.f90 @@ -43,7 +43,7 @@ module function isoductile_init(source_length) result(mySources) print'(/,a)', ' <<<+- phase:damage:isoductile init -+>>>' - mySources = source_active('damage_isoDuctile',source_length) + mySources = source_active('isoductile',source_length) Ninstances = count(mySources) print'(a,i2)', ' # instances: ',Ninstances; flush(IO_STDOUT) if(Ninstances == 0) return @@ -57,7 +57,7 @@ module function isoductile_init(source_length) result(mySources) phase => phases%get(p) if(count(mySources(:,p)) == 0) cycle if(any(mySources(:,p))) source_damage_isoDuctile_instance(p) = count(mySources(:,1:p)) - sources => phase%get('source') + sources => phase%get('damage') do sourceOffset = 1, sources%length if(mySources(sourceOffset,p)) then source_damage_isoDuctile_offset(p) = sourceOffset diff --git a/src/phase_mechanical_eigen.f90 b/src/phase_mechanical_eigen.f90 index 6df993565..3fb2d1bf2 100644 --- a/src/phase_mechanical_eigen.f90 +++ b/src/phase_mechanical_eigen.f90 @@ -66,7 +66,8 @@ module subroutine eigendeformation_init(phases) ph class(tNode), pointer :: & phase, & - kinematics + kinematics, & + damage print'(/,a)', ' <<<+- phase:mechanics:eigendeformation init -+>>>' @@ -77,6 +78,12 @@ module subroutine eigendeformation_init(phases) phase => phases%get(ph) kinematics => phase%get('kinematics',defaultVal=emptyList) phase_Nkinematics(ph) = kinematics%length + kinematics => phase%get('damage',defaultVal=emptyList) + if(kinematics%length >0) then + damage => kinematics%get(1) + if(damage%get_asString('type') == 'anisobrittle') phase_Nkinematics(ph) = phase_Nkinematics(ph) +1 + if(damage%get_asString('type') == 'isoductile') phase_Nkinematics(ph) = phase_Nkinematics(ph) +1 + endif enddo allocate(phase_kinematics(maxval(phase_Nkinematics),phases%length), source = KINEMATICS_undefined_ID) @@ -90,7 +97,6 @@ module subroutine eigendeformation_init(phases) end subroutine eigendeformation_init - !-------------------------------------------------------------------------------------------------- !> @brief checks if a kinematic mechanism is active or not !-------------------------------------------------------------------------------------------------- @@ -122,6 +128,38 @@ function kinematics_active(kinematics_label,kinematics_length) result(active_ki end function kinematics_active + +!-------------------------------------------------------------------------------------------------- +!> @brief checks if a kinematic mechanism is active or not +!-------------------------------------------------------------------------------------------------- +function kinematics_active2(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 => config_material%get('phase') + allocate(active_kinematics(kinematics_length,phases%length), source = .false. ) + do p = 1, phases%length + phase => phases%get(p) + kinematics => phase%get('damage',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_active2 + + !-------------------------------------------------------------------------------------------------- !> @brief contains the constitutive equation for calculating the velocity gradient ! ToDo: MD: S is Mi? @@ -175,8 +213,10 @@ module subroutine phase_LiAndItsTangents(Li, dLi_dS, dLi_dFi, & KinematicsLoop: do k = 1, phase_Nkinematics(material_phaseAt(co,el)) kinematicsType: select case (phase_kinematics(k,material_phaseAt(co,el))) case (KINEMATICS_cleavage_opening_ID) kinematicsType + print*, 'clea' call kinematics_cleavage_opening_LiAndItsTangent(my_Li, my_dLi_dS, S, co, ip, el) case (KINEMATICS_slipplane_opening_ID) kinematicsType + print*, 'slipp' call kinematics_slipplane_opening_LiAndItsTangent(my_Li, my_dLi_dS, S, co, ip, el) case (KINEMATICS_thermal_expansion_ID) kinematicsType me = material_phaseMemberAt(co,ip,el) diff --git a/src/phase_mechanical_eigen_cleavageopening.f90 b/src/phase_mechanical_eigen_cleavageopening.f90 index 55102e196..f1774c78e 100644 --- a/src/phase_mechanical_eigen_cleavageopening.f90 +++ b/src/phase_mechanical_eigen_cleavageopening.f90 @@ -46,7 +46,7 @@ module function kinematics_cleavage_opening_init(kinematics_length) result(myKin print'(/,a)', ' <<<+- phase:mechanics:eigendeformation:cleavageopening init -+>>>' - myKinematics = kinematics_active('cleavage_opening',kinematics_length) + myKinematics = kinematics_active2('anisobrittle',kinematics_length) Ninstances = count(myKinematics) print'(a,i2)', ' # instances: ',Ninstances; flush(IO_STDOUT) if(Ninstances == 0) return @@ -59,7 +59,7 @@ module function kinematics_cleavage_opening_init(kinematics_length) result(myKin if(any(myKinematics(:,p))) kinematics_cleavage_opening_instance(p) = count(myKinematics(:,1:p)) phase => phases%get(p) if(count(myKinematics(:,p)) == 0) cycle - kinematics => phase%get('kinematics') + kinematics => phase%get('damage') do k = 1, kinematics%length if(myKinematics(k,p)) then associate(prm => param(kinematics_cleavage_opening_instance(p))) diff --git a/src/phase_mechanical_eigen_slipplaneopening.f90 b/src/phase_mechanical_eigen_slipplaneopening.f90 index cf5e918b3..dd5f172d9 100644 --- a/src/phase_mechanical_eigen_slipplaneopening.f90 +++ b/src/phase_mechanical_eigen_slipplaneopening.f90 @@ -51,7 +51,7 @@ module function kinematics_slipplane_opening_init(kinematics_length) result(myKi print'(/,a)', ' <<<+- phase:mechanics:eigendeformation:slipplaneopening init -+>>>' - myKinematics = kinematics_active('slipplane_opening',kinematics_length) + myKinematics = kinematics_active2('isoductile',kinematics_length) Ninstances = count(myKinematics) print'(a,i2)', ' # instances: ',Ninstances; flush(IO_STDOUT) if(Ninstances == 0) return @@ -66,7 +66,7 @@ module function kinematics_slipplane_opening_init(kinematics_length) result(myKi mech => phase%get('mechanics') pl => mech%get('plasticity') if(count(myKinematics(:,p)) == 0) cycle - kinematics => phase%get('kinematics') + kinematics => phase%get('damage') do k = 1, kinematics%length if(myKinematics(k,p)) then associate(prm => param(kinematics_slipplane_opening_instance(p))) From 2b0b1aeffe0c18e0350ebcf2e9039cae98151724 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Fri, 12 Feb 2021 23:35:06 +0100 Subject: [PATCH 30/60] jobname.yaml not supported anymore --- PRIVATE | 2 +- src/config.f90 | 23 +++++++---------------- 2 files changed, 8 insertions(+), 17 deletions(-) diff --git a/PRIVATE b/PRIVATE index 07d125fe4..2a0f30ec4 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit 07d125fe476621224d9f2ef73b0cf88f3b07bc60 +Subproject commit 2a0f30ec47473f42e0da922055b72b527730378d diff --git a/src/config.f90 b/src/config.f90 index b10edf013..02b16f2a2 100644 --- a/src/config.f90 +++ b/src/config.f90 @@ -5,16 +5,10 @@ !! precedence over material.yaml. !-------------------------------------------------------------------------------------------------- module config - use prec - use DAMASK_interface use IO use YAML_parse use YAML_types -#ifdef PETSc -#include - use petscsys -#endif implicit none private @@ -50,17 +44,12 @@ end subroutine config_init subroutine parse_material logical :: fileExists - character(len=:), allocatable :: fname - 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 - print*, 'reading '//fname; flush(IO_STDOUT) - config_material => YAML_parse_file(fname) + + inquire(file='material.yaml',exist=fileExists) + if(.not. fileExists) call IO_error(100,ext_msg='material.yaml') + print*, 'reading material.yaml'; flush(IO_STDOUT) + config_material => YAML_parse_file('material.yaml') end subroutine parse_material @@ -72,6 +61,7 @@ subroutine parse_numerics logical :: fexist + config_numerics => emptyDict inquire(file='numerics.yaml', exist=fexist) if (fexist) then @@ -89,6 +79,7 @@ subroutine parse_debug logical :: fexist + config_debug => emptyDict inquire(file='debug.yaml', exist=fexist) fileExists: if (fexist) then From c790c82a427de2a024e935af18488ee9dcc6c85d Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sat, 13 Feb 2021 06:59:18 +0100 Subject: [PATCH 31/60] separating by instance just complicates things --- src/material.f90 | 2 +- src/phase_mechanical_eigen_cleavageopening.f90 | 15 ++++----------- src/phase_mechanical_eigen_slipplaneopening.f90 | 14 +++----------- 3 files changed, 8 insertions(+), 23 deletions(-) diff --git a/src/material.f90 b/src/material.f90 index df6dc6dd1..3656f0f0a 100644 --- a/src/material.f90 +++ b/src/material.f90 @@ -48,7 +48,7 @@ module material contains !-------------------------------------------------------------------------------------------------- -!> @brief parses material configuration file +!> @brief Parse material configuration file (material.yaml). !-------------------------------------------------------------------------------------------------- subroutine material_init(restart) diff --git a/src/phase_mechanical_eigen_cleavageopening.f90 b/src/phase_mechanical_eigen_cleavageopening.f90 index f1774c78e..8878c10bd 100644 --- a/src/phase_mechanical_eigen_cleavageopening.f90 +++ b/src/phase_mechanical_eigen_cleavageopening.f90 @@ -6,8 +6,6 @@ !-------------------------------------------------------------------------------------------------- submodule(phase:eigendeformation) cleavageopening - integer, dimension(:), allocatable :: kinematics_cleavage_opening_instance - type :: tParameters !< container type for internal constitutive parameters integer :: & sum_N_cl !< total number of cleavage planes @@ -20,7 +18,7 @@ submodule(phase:eigendeformation) cleavageopening cleavage_systems end type tParameters - type(tParameters), dimension(:), allocatable :: param !< containers of constitutive parameters (len Ninstances) + type(tParameters), dimension(:), allocatable :: param !< containers of constitutive parameters contains @@ -52,17 +50,15 @@ module function kinematics_cleavage_opening_init(kinematics_length) result(myKin if(Ninstances == 0) return phases => config_material%get('phase') - allocate(param(Ninstances)) - allocate(kinematics_cleavage_opening_instance(phases%length), source=0) + allocate(param(phases%length)) do p = 1, phases%length - if(any(myKinematics(:,p))) kinematics_cleavage_opening_instance(p) = count(myKinematics(:,1:p)) phase => phases%get(p) if(count(myKinematics(:,p)) == 0) cycle kinematics => phase%get('damage') do k = 1, kinematics%length if(myKinematics(k,p)) then - associate(prm => param(kinematics_cleavage_opening_instance(p))) + associate(prm => param(p)) kinematic_type => kinematics%get(k) N_cl = kinematic_type%get_asInts('N_cl') @@ -113,18 +109,15 @@ module subroutine kinematics_cleavage_opening_LiAndItsTangent(Ld, dLd_dTstar, S, dLd_dTstar !< derivative of Ld with respect to Tstar (4th-order tensor) integer :: & - homog, damageOffset, & i, k, l, m, n real(pReal) :: & traction_d, traction_t, traction_n, traction_crit, & udotd, dudotd_dt, udott, dudott_dt, udotn, dudotn_dt - homog = material_homogenizationAt(el) - damageOffset = material_homogenizationMemberAt(ip,el) Ld = 0.0_pReal dLd_dTstar = 0.0_pReal - associate(prm => param(kinematics_cleavage_opening_instance(material_phaseAt(co,el)))) + associate(prm => param(material_phaseAt(co,el))) do i = 1,prm%sum_N_cl traction_crit = prm%g_crit(i)*phase_damage_get_phi(co,ip,el)**2.0_pReal diff --git a/src/phase_mechanical_eigen_slipplaneopening.f90 b/src/phase_mechanical_eigen_slipplaneopening.f90 index dd5f172d9..e8410a935 100644 --- a/src/phase_mechanical_eigen_slipplaneopening.f90 +++ b/src/phase_mechanical_eigen_slipplaneopening.f90 @@ -57,11 +57,9 @@ module function kinematics_slipplane_opening_init(kinematics_length) result(myKi if(Ninstances == 0) return phases => config_material%get('phase') - allocate(kinematics_slipplane_opening_instance(phases%length), source=0) - allocate(param(Ninstances)) + allocate(param(phases%length)) do p = 1, phases%length - if(any(myKinematics(:,p))) kinematics_slipplane_opening_instance(p) = count(myKinematics(:,1:p)) phase => phases%get(p) mech => phase%get('mechanics') pl => mech%get('plasticity') @@ -69,7 +67,7 @@ module function kinematics_slipplane_opening_init(kinematics_length) result(myKi kinematics => phase%get('damage') do k = 1, kinematics%length if(myKinematics(k,p)) then - associate(prm => param(kinematics_slipplane_opening_instance(p))) + associate(prm => param(p)) kinematic_type => kinematics%get(k) prm%dot_o = kinematic_type%get_asFloat('dot_o') @@ -131,19 +129,13 @@ module subroutine kinematics_slipplane_opening_LiAndItsTangent(Ld, dLd_dTstar, S dLd_dTstar !< derivative of Ld with respect to Tstar (4th-order tensor) integer :: & - instance, phase, & - homog, damageOffset, & i, k, l, m, n real(pReal) :: & traction_d, traction_t, traction_n, traction_crit, & udotd, dudotd_dt, udott, dudott_dt, udotn, dudotn_dt - phase = material_phaseAt(co,el) - instance = kinematics_slipplane_opening_instance(phase) - homog = material_homogenizationAt(el) - damageOffset = material_homogenizationMemberAt(ip,el) - associate(prm => param(instance)) + associate(prm => param(material_phaseAt(co,el))) Ld = 0.0_pReal dLd_dTstar = 0.0_pReal do i = 1, prm%sum_N_sl From f95e3bc08d58f7434a23c730c02c1585bc30035a Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sat, 13 Feb 2021 07:15:57 +0100 Subject: [PATCH 32/60] simplified access pattern --- src/phase.f90 | 5 +++ src/phase_damage.f90 | 11 +++++ src/phase_mechanical.f90 | 11 ++--- src/phase_mechanical_eigen.f90 | 43 ++++++------------- ...phase_mechanical_eigen_cleavageopening.f90 | 10 ++--- ...hase_mechanical_eigen_slipplaneopening.f90 | 10 ++--- 6 files changed, 42 insertions(+), 48 deletions(-) diff --git a/src/phase.f90 b/src/phase.f90 index 628bfc443..82b82d71d 100644 --- a/src/phase.f90 +++ b/src/phase.f90 @@ -181,6 +181,11 @@ module phase real(pReal) :: dot_T end function thermal_dot_T + module function damage_phi(ph,me) result(phi) + integer, intent(in) :: ph,me + real(pReal) :: phi + end function damage_phi + module subroutine phase_mechanical_setF(F,co,ip,el) real(pReal), dimension(3,3), intent(in) :: F diff --git a/src/phase_damage.f90 b/src/phase_damage.f90 index 6063f3583..8defcf3a1 100644 --- a/src/phase_damage.f90 +++ b/src/phase_damage.f90 @@ -528,4 +528,15 @@ module function phase_damage_get_phi(co,ip,el) result(phi) end function phase_damage_get_phi +module function damage_phi(ph,me) result(phi) + + integer, intent(in) :: ph, me + real(pReal) :: phi + + + phi = current(ph)%phi(me) + +end function damage_phi + + end submodule damagee diff --git a/src/phase_mechanical.f90 b/src/phase_mechanical.f90 index 61151d33b..f7631a38d 100644 --- a/src/phase_mechanical.f90 +++ b/src/phase_mechanical.f90 @@ -98,12 +98,9 @@ submodule(phase) mechanics end function plastic_deltaState module subroutine phase_LiAndItsTangents(Li, dLi_dS, dLi_dFi, & - S, Fi, co, ip, el) - + S, Fi, ph,me) integer, intent(in) :: & - co, & !< component-ID of integration point - ip, & !< integration point - el !< element + ph,me real(pReal), intent(in), dimension(3,3) :: & S !< 2nd Piola-Kirchhoff stress real(pReal), intent(in), dimension(3,3) :: & @@ -583,7 +580,7 @@ function integrateStress(F,subFp0,subFi0,Delta_t,co,ip,el) result(broken) enddo LpLoop call phase_LiAndItsTangents(Li_constitutive, dLi_dS, dLi_dFi, & - S, Fi_new, co, ip, el) + S, Fi_new, ph,me) !* update current residuum and check for convergence of loop atol_Li = max(num%rtol_crystalliteStress * max(norm2(Liguess),norm2(Li_constitutive)), & ! absolute tolerance from largest acceptable relative error @@ -1303,7 +1300,7 @@ module function phase_mechanical_dPdF(dt,co,ip,el) result(dPdF) call phase_LiAndItsTangents(devNull,dLidS,dLidFi, & phase_mechanical_S(ph)%data(1:3,1:3,me), & phase_mechanical_Fi(ph)%data(1:3,1:3,me), & - co,ip,el) + ph,me) invFp = math_inv33(phase_mechanical_Fp(ph)%data(1:3,1:3,me)) invFi = math_inv33(phase_mechanical_Fi(ph)%data(1:3,1:3,me)) diff --git a/src/phase_mechanical_eigen.f90 b/src/phase_mechanical_eigen.f90 index 3fb2d1bf2..9eb3c5767 100644 --- a/src/phase_mechanical_eigen.f90 +++ b/src/phase_mechanical_eigen.f90 @@ -16,11 +16,8 @@ submodule(phase:mechanics) eigendeformation logical, dimension(:,:), allocatable :: myKinematics end function kinematics_thermal_expansion_init - module subroutine kinematics_cleavage_opening_LiAndItsTangent(Ld, dLd_dTstar, S, co, ip, el) - integer, intent(in) :: & - co, & !< grain number - ip, & !< integration point number - el !< element number + module subroutine kinematics_cleavage_opening_LiAndItsTangent(Ld, dLd_dTstar, S, ph,me) + integer, intent(in) :: ph, me real(pReal), intent(in), dimension(3,3) :: & S real(pReal), intent(out), dimension(3,3) :: & @@ -29,11 +26,8 @@ submodule(phase:mechanics) eigendeformation dLd_dTstar !< derivative of Ld with respect to Tstar (4th-order tensor) end subroutine kinematics_cleavage_opening_LiAndItsTangent - module subroutine kinematics_slipplane_opening_LiAndItsTangent(Ld, dLd_dTstar, S, co, ip, el) - integer, intent(in) :: & - co, & !< grain number - ip, & !< integration point number - el !< element number + module subroutine kinematics_slipplane_opening_LiAndItsTangent(Ld, dLd_dTstar, S, ph,me) + integer, intent(in) :: ph, me real(pReal), intent(in), dimension(3,3) :: & S real(pReal), intent(out), dimension(3,3) :: & @@ -44,7 +38,6 @@ submodule(phase:mechanics) eigendeformation module subroutine thermalexpansion_LiAndItsTangent(Li, dLi_dTstar, ph,me) integer, intent(in) :: ph, me - !< element number real(pReal), intent(out), dimension(3,3) :: & Li !< thermal velocity gradient real(pReal), intent(out), dimension(3,3,3,3) :: & @@ -165,12 +158,10 @@ end function kinematics_active2 ! ToDo: MD: S is Mi? !-------------------------------------------------------------------------------------------------- module subroutine phase_LiAndItsTangents(Li, dLi_dS, dLi_dFi, & - S, Fi, co, ip, el) + S, Fi, ph,me) integer, intent(in) :: & - co, & !< component-ID of integration point - ip, & !< integration point - el !< element + ph,me real(pReal), intent(in), dimension(3,3) :: & S !< 2nd Piola-Kirchhoff stress real(pReal), intent(in), dimension(3,3) :: & @@ -190,18 +181,16 @@ module subroutine phase_LiAndItsTangents(Li, dLi_dS, dLi_dFi, & real(pReal) :: & detFi integer :: & - k, i, j, & - instance, of, me, ph + k, i, j Li = 0.0_pReal dLi_dS = 0.0_pReal dLi_dFi = 0.0_pReal - plasticType: select case (phase_plasticity(material_phaseAt(co,el))) + + plasticType: select case (phase_plasticity(ph)) case (PLASTICITY_isotropic_ID) plasticType - of = material_phasememberAt(co,ip,el) - instance = phase_plasticInstance(material_phaseAt(co,el)) - call plastic_isotropic_LiAndItsTangent(my_Li, my_dLi_dS, S ,instance,of) + call plastic_isotropic_LiAndItsTangent(my_Li, my_dLi_dS, S ,phase_plasticInstance(ph),me) case default plasticType my_Li = 0.0_pReal my_dLi_dS = 0.0_pReal @@ -210,17 +199,13 @@ module subroutine phase_LiAndItsTangents(Li, dLi_dS, dLi_dFi, & Li = Li + my_Li dLi_dS = dLi_dS + my_dLi_dS - KinematicsLoop: do k = 1, phase_Nkinematics(material_phaseAt(co,el)) - kinematicsType: select case (phase_kinematics(k,material_phaseAt(co,el))) + KinematicsLoop: do k = 1, phase_Nkinematics(ph) + kinematicsType: select case (phase_kinematics(k,ph)) case (KINEMATICS_cleavage_opening_ID) kinematicsType - print*, 'clea' - call kinematics_cleavage_opening_LiAndItsTangent(my_Li, my_dLi_dS, S, co, ip, el) + call kinematics_cleavage_opening_LiAndItsTangent(my_Li, my_dLi_dS, S, ph, me) case (KINEMATICS_slipplane_opening_ID) kinematicsType - print*, 'slipp' - call kinematics_slipplane_opening_LiAndItsTangent(my_Li, my_dLi_dS, S, co, ip, el) + call kinematics_slipplane_opening_LiAndItsTangent(my_Li, my_dLi_dS, S, ph, me) case (KINEMATICS_thermal_expansion_ID) kinematicsType - me = material_phaseMemberAt(co,ip,el) - ph = material_phaseAt(co,el) call thermalexpansion_LiAndItsTangent(my_Li, my_dLi_dS, ph,me) case default kinematicsType my_Li = 0.0_pReal diff --git a/src/phase_mechanical_eigen_cleavageopening.f90 b/src/phase_mechanical_eigen_cleavageopening.f90 index 8878c10bd..5bb9847f4 100644 --- a/src/phase_mechanical_eigen_cleavageopening.f90 +++ b/src/phase_mechanical_eigen_cleavageopening.f90 @@ -95,12 +95,10 @@ end function kinematics_cleavage_opening_init !-------------------------------------------------------------------------------------------------- !> @brief contains the constitutive equation for calculating the velocity gradient !-------------------------------------------------------------------------------------------------- -module subroutine kinematics_cleavage_opening_LiAndItsTangent(Ld, dLd_dTstar, S, co, ip, el) +module subroutine kinematics_cleavage_opening_LiAndItsTangent(Ld, dLd_dTstar, S, ph,me) integer, intent(in) :: & - co, & !< grain number - ip, & !< integration point number - el !< element number + ph,me real(pReal), intent(in), dimension(3,3) :: & S real(pReal), intent(out), dimension(3,3) :: & @@ -117,9 +115,9 @@ module subroutine kinematics_cleavage_opening_LiAndItsTangent(Ld, dLd_dTstar, S, Ld = 0.0_pReal dLd_dTstar = 0.0_pReal - associate(prm => param(material_phaseAt(co,el))) + associate(prm => param(ph)) do i = 1,prm%sum_N_cl - traction_crit = prm%g_crit(i)*phase_damage_get_phi(co,ip,el)**2.0_pReal + traction_crit = prm%g_crit(i)*damage_phi(ph,me)**2.0_pReal traction_d = math_tensordot(S,prm%cleavage_systems(1:3,1:3,1,i)) if (abs(traction_d) > traction_crit + tol_math_check) then diff --git a/src/phase_mechanical_eigen_slipplaneopening.f90 b/src/phase_mechanical_eigen_slipplaneopening.f90 index e8410a935..64988d87f 100644 --- a/src/phase_mechanical_eigen_slipplaneopening.f90 +++ b/src/phase_mechanical_eigen_slipplaneopening.f90 @@ -115,12 +115,10 @@ end function kinematics_slipplane_opening_init !-------------------------------------------------------------------------------------------------- !> @brief contains the constitutive equation for calculating the velocity gradient !-------------------------------------------------------------------------------------------------- -module subroutine kinematics_slipplane_opening_LiAndItsTangent(Ld, dLd_dTstar, S, co, ip, el) +module subroutine kinematics_slipplane_opening_LiAndItsTangent(Ld, dLd_dTstar, S, ph,me) integer, intent(in) :: & - co, & !< grain number - ip, & !< integration point number - el !< element number + ph, me real(pReal), intent(in), dimension(3,3) :: & S real(pReal), intent(out), dimension(3,3) :: & @@ -135,7 +133,7 @@ module subroutine kinematics_slipplane_opening_LiAndItsTangent(Ld, dLd_dTstar, S udotd, dudotd_dt, udott, dudott_dt, udotn, dudotn_dt - associate(prm => param(material_phaseAt(co,el))) + associate(prm => param(ph)) Ld = 0.0_pReal dLd_dTstar = 0.0_pReal do i = 1, prm%sum_N_sl @@ -144,7 +142,7 @@ module subroutine kinematics_slipplane_opening_LiAndItsTangent(Ld, dLd_dTstar, S traction_t = math_tensordot(S,prm%P_t(1:3,1:3,i)) traction_n = math_tensordot(S,prm%P_n(1:3,1:3,i)) - traction_crit = prm%g_crit(i)* phase_damage_get_phi(co,ip,el) ! degrading critical load carrying capacity by damage + traction_crit = prm%g_crit(i)* damage_phi(ph,me) udotd = sign(1.0_pReal,traction_d)* prm%dot_o* ( abs(traction_d)/traction_crit & - abs(traction_d)/prm%g_crit(i))**prm%q From 6e3515982d6fe4c727731297577d4aafe1930665 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sat, 13 Feb 2021 07:55:32 +0100 Subject: [PATCH 33/60] not needed outside of thermal --- src/phase.f90 | 2 +- src/phase_thermal.f90 | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/phase.f90 b/src/phase.f90 index 82b82d71d..1d08f680d 100644 --- a/src/phase.f90 +++ b/src/phase.f90 @@ -71,7 +71,7 @@ module phase type(tPlasticState), allocatable, dimension(:), public :: & plasticState type(tSourceState), allocatable, dimension(:), public :: & - damageState, thermalState + damageState integer, public, protected :: & diff --git a/src/phase_thermal.f90 b/src/phase_thermal.f90 index 85ca2f7a5..5d3d89ccb 100644 --- a/src/phase_thermal.f90 +++ b/src/phase_thermal.f90 @@ -3,6 +3,9 @@ !---------------------------------------------------------------------------------------------------- submodule(phase) thermal + type(tSourceState), allocatable, dimension(:) :: & + thermalState + enum, bind(c); enumerator :: & THERMAL_UNDEFINED_ID ,& THERMAL_DISSIPATION_ID, & From b3dde6d7227b60a830c2486d068ca8b6b5b0343c Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sat, 13 Feb 2021 08:32:43 +0100 Subject: [PATCH 34/60] only one damage mechanism per phase material.yaml specification is designed to allow more than one, but that requires to have two phase fields etc. For the moment, keep it as simple as possible. --- PRIVATE | 2 +- src/phase.f90 | 43 +++++++++---------- src/phase_damage.f90 | 71 +++++++++++++------------------ src/phase_damage_anisobrittle.f90 | 30 +++++-------- src/phase_damage_anisoductile.f90 | 29 ++++--------- src/phase_damage_isobrittle.f90 | 37 ++++++---------- src/phase_damage_isoductile.f90 | 29 ++++--------- src/phase_mechanical.f90 | 18 ++++---- 8 files changed, 97 insertions(+), 162 deletions(-) diff --git a/PRIVATE b/PRIVATE index 2a0f30ec4..571b06ac4 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit 2a0f30ec47473f42e0da922055b72b527730378d +Subproject commit 571b06ac4b42ed217eacfa5c71281e571bdab1df diff --git a/src/phase.f90 b/src/phase.f90 index 1d08f680d..8ea1fa5f7 100644 --- a/src/phase.f90 +++ b/src/phase.f90 @@ -70,7 +70,7 @@ module phase type(tPlasticState), allocatable, dimension(:), public :: & plasticState - type(tSourceState), allocatable, dimension(:), public :: & + type(tState), allocatable, dimension(:), public :: & damageState @@ -350,14 +350,12 @@ subroutine phase_init PhaseLoop2:do ph = 1,phases%length !-------------------------------------------------------------------------------------------------- ! partition and initialize state - plasticState(ph)%state = plasticState(ph)%state0 - forall(so = 1:phase_Nsources(ph)) - damageState(ph)%p(so)%state = damageState(ph)%p(so)%state0 - end forall - - phase_source_maxSizeDotState = max(phase_source_maxSizeDotState, & - maxval(damageState(ph)%p%sizeDotState)) + plasticState(ph)%state = plasticState(ph)%state0 + if(phase_Nsources(ph) > 0) & + damageState(ph)%state = damageState(ph)%state0 enddo PhaseLoop2 + + phase_source_maxSizeDotState = maxval(damageState%sizeDotState) phase_plasticity_maxSizeDotState = maxval(plasticState%sizeDotState) end subroutine phase_init @@ -404,15 +402,13 @@ subroutine phase_restore(ce,includeL) integer, intent(in) :: ce integer :: & - co, & !< constituent number - so + co do co = 1,homogenization_Nconstituents(material_homogenizationAt2(ce)) - do so = 1, phase_Nsources(material_phaseAt2(co,ce)) - damageState(material_phaseAt2(co,ce))%p(so)%state( :,material_phasememberAt2(co,ce)) = & - damageState(material_phaseAt2(co,ce))%p(so)%state0(:,material_phasememberAt2(co,ce)) - enddo + if (phase_Nsources(material_phaseAt2(co,ce)) > 0) & + damageState(material_phaseAt2(co,ce))%state( :,material_phasememberAt2(co,ce)) = & + damageState(material_phaseAt2(co,ce))%state0(:,material_phasememberAt2(co,ce)) enddo call mechanical_restore(ce,includeL) @@ -426,16 +422,16 @@ end subroutine phase_restore !-------------------------------------------------------------------------------------------------- subroutine phase_forward() - integer :: ph, so + integer :: ph call mechanical_forward() call thermal_forward() do ph = 1, size(damageState) - do so = 1,phase_Nsources(ph) - damageState(ph)%p(so)%state0 = damageState(ph)%p(so)%state - enddo; enddo + if (phase_Nsources(ph) > 0) & + damageState(ph)%state0 = damageState(ph)%state + enddo end subroutine phase_forward @@ -531,9 +527,8 @@ subroutine crystallite_init() phases => config_material%get('phase') do ph = 1, phases%length - do so = 1, phase_Nsources(ph) - allocate(damageState(ph)%p(so)%subState0,source=damageState(ph)%p(so)%state0) ! ToDo: hack - enddo + if (phase_Nsources(ph) > 0) & + allocate(damageState(ph)%subState0,source=damageState(ph)%state0) ! ToDo: hack enddo print'(a42,1x,i10)', ' # of elements: ', eMax @@ -579,9 +574,9 @@ subroutine phase_windForward(ip,el) call mechanical_windForward(ph,me) - do so = 1, phase_Nsources(material_phaseAt(co,el)) - damageState(ph)%p(so)%state0(:,me) = damageState(ph)%p(so)%state(:,me) - enddo + if (phase_Nsources(ph) > 0) & + damageState(ph)%state0(:,me) = damageState(ph)%state(:,me) + enddo diff --git a/src/phase_damage.f90 b/src/phase_damage.f90 index 8defcf3a1..5f323c3a2 100644 --- a/src/phase_damage.f90 +++ b/src/phase_damage.f90 @@ -176,8 +176,8 @@ module subroutine damage_init phase => phases%get(ph) sources => phase%get('damage',defaultVal=emptyList) - phase_Nsources(ph) = sources%length - allocate(damageState(ph)%p(phase_Nsources(ph))) + if (sources%length > 1) error stop + enddo allocate(phase_source(maxval(phase_Nsources),phases%length), source = DAMAGE_UNDEFINED_ID) @@ -267,57 +267,48 @@ module function integrateDamageState(dt,co,ip,el) result(broken) NiterationState, & !< number of iterations in state loop ph, & me, & - so - integer, dimension(maxval(phase_Nsources)) :: & size_so real(pReal) :: & zeta real(pReal), dimension(phase_source_maxSizeDotState) :: & r ! state residuum - real(pReal), dimension(phase_source_maxSizeDotState,2,maxval(phase_Nsources)) :: source_dotState + real(pReal), dimension(phase_source_maxSizeDotState,2) :: source_dotState logical :: & converged_ - ph = material_phaseAt(co,el) + if (phase_Nsources(ph) == 0) return me = material_phaseMemberAt(co,ip,el) converged_ = .true. broken = phase_damage_collectDotState(co,ip,el,ph,me) if(broken) return - do so = 1, phase_Nsources(ph) - size_so(so) = damageState(ph)%p(so)%sizeDotState - damageState(ph)%p(so)%state(1:size_so(so),me) = damageState(ph)%p(so)%subState0(1:size_so(so),me) & - + damageState(ph)%p(so)%dotState (1:size_so(so),me) * dt - source_dotState(1:size_so(so),2,so) = 0.0_pReal - enddo + size_so = damageState(ph)%sizeDotState + damageState(ph)%state(1:size_so,me) = damageState(ph)%subState0(1:size_so,me) & + + damageState(ph)%dotState (1:size_so,me) * dt + source_dotState(1:size_so,2) = 0.0_pReal iteration: do NiterationState = 1, num%nState - do so = 1, phase_Nsources(ph) - if(nIterationState > 1) source_dotState(1:size_so(so),2,so) = source_dotState(1:size_so(so),1,so) - source_dotState(1:size_so(so),1,so) = damageState(ph)%p(so)%dotState(:,me) - enddo + if(nIterationState > 1) source_dotState(1:size_so,2) = source_dotState(1:size_so,1) + source_dotState(1:size_so,1) = damageState(ph)%dotState(:,me) broken = phase_damage_collectDotState(co,ip,el,ph,me) if(broken) exit iteration - do so = 1, phase_Nsources(ph) - zeta = damper(damageState(ph)%p(so)%dotState(:,me), & - source_dotState(1:size_so(so),1,so),& - source_dotState(1:size_so(so),2,so)) - damageState(ph)%p(so)%dotState(:,me) = damageState(ph)%p(so)%dotState(:,me) * zeta & - + source_dotState(1:size_so(so),1,so)* (1.0_pReal - zeta) - r(1:size_so(so)) = damageState(ph)%p(so)%state (1:size_so(so),me) & - - damageState(ph)%p(so)%subState0(1:size_so(so),me) & - - damageState(ph)%p(so)%dotState (1:size_so(so),me) * dt - damageState(ph)%p(so)%state(1:size_so(so),me) = damageState(ph)%p(so)%state(1:size_so(so),me) & - - r(1:size_so(so)) - converged_ = converged_ .and. converged(r(1:size_so(so)), & - damageState(ph)%p(so)%state(1:size_so(so),me), & - damageState(ph)%p(so)%atol(1:size_so(so))) - enddo + + zeta = damper(damageState(ph)%dotState(:,me),source_dotState(1:size_so,1),source_dotState(1:size_so,2)) + damageState(ph)%dotState(:,me) = damageState(ph)%dotState(:,me) * zeta & + + source_dotState(1:size_so,1)* (1.0_pReal - zeta) + r(1:size_so) = damageState(ph)%state (1:size_so,me) & + - damageState(ph)%subState0(1:size_so,me) & + - damageState(ph)%dotState (1:size_so,me) * dt + damageState(ph)%state(1:size_so,me) = damageState(ph)%state(1:size_so,me) - r(1:size_so) + converged_ = converged_ .and. converged(r(1:size_so), & + damageState(ph)%state(1:size_so,me), & + damageState(ph)%atol(1:size_so)) + if(converged_) then broken = phase_damage_deltaState(mechanical_F_e(ph,me),ph,me) @@ -423,7 +414,7 @@ function phase_damage_collectDotState(co,ip,el,ph,me) result(broken) end select sourceType - broken = broken .or. any(IEEE_is_NaN(damageState(ph)%p(so)%dotState(:,me))) + broken = broken .or. any(IEEE_is_NaN(damageState(ph)%dotState(:,me))) enddo SourceLoop @@ -443,7 +434,6 @@ function phase_damage_deltaState(Fe, ph, me) result(broken) real(pReal), intent(in), dimension(3,3) :: & Fe !< elastic deformation gradient integer :: & - so, & myOffset, & mySize logical :: & @@ -452,23 +442,22 @@ function phase_damage_deltaState(Fe, ph, me) result(broken) broken = .false. - sourceLoop: do so = 1, phase_Nsources(ph) + if (phase_Nsources(ph) == 0) return - sourceType: select case (phase_source(so,ph)) + sourceType: select case (phase_source(1,ph)) case (DAMAGE_ISOBRITTLE_ID) sourceType call source_damage_isoBrittle_deltaState(phase_homogenizedC(ph,me), Fe, ph,me) - broken = any(IEEE_is_NaN(damageState(ph)%p(so)%deltaState(:,me))) + broken = any(IEEE_is_NaN(damageState(ph)%deltaState(:,me))) if(.not. broken) then - myOffset = damageState(ph)%p(so)%offsetDeltaState - mySize = damageState(ph)%p(so)%sizeDeltaState - damageState(ph)%p(so)%state(myOffset + 1: myOffset + mySize,me) = & - damageState(ph)%p(so)%state(myOffset + 1: myOffset + mySize,me) + damageState(ph)%p(so)%deltaState(1:mySize,me) + myOffset = damageState(ph)%offsetDeltaState + mySize = damageState(ph)%sizeDeltaState + damageState(ph)%state(myOffset + 1: myOffset + mySize,me) = & + damageState(ph)%state(myOffset + 1: myOffset + mySize,me) + damageState(ph)%deltaState(1:mySize,me) endif end select sourceType - enddo SourceLoop end function phase_damage_deltaState diff --git a/src/phase_damage_anisobrittle.f90 b/src/phase_damage_anisobrittle.f90 index ad7f80604..422b2a91a 100644 --- a/src/phase_damage_anisobrittle.f90 +++ b/src/phase_damage_anisobrittle.f90 @@ -6,8 +6,7 @@ !-------------------------------------------------------------------------------------------------- submodule (phase:damagee) anisobrittle - integer, dimension(:), allocatable :: & - source_damage_anisoBrittle_offset, & !< which source is my current source mechanism? + integer, dimension(:), allocatable :: & source_damage_anisoBrittle_instance !< instance of source mechanism type :: tParameters !< container type for internal constitutive parameters @@ -58,7 +57,6 @@ module function anisobrittle_init(source_length) result(mySources) phases => config_material%get('phase') allocate(param(Ninstances)) - allocate(source_damage_anisoBrittle_offset (phases%length), source=0) allocate(source_damage_anisoBrittle_instance(phases%length), source=0) do p = 1, phases%length @@ -68,7 +66,6 @@ module function anisobrittle_init(source_length) result(mySources) sources => phase%get('damage') do sourceOffset = 1, sources%length if(mySources(sourceOffset,p)) then - source_damage_anisoBrittle_offset(p) = sourceOffset associate(prm => param(source_damage_anisoBrittle_instance(p))) src => sources%get(sourceOffset) @@ -101,9 +98,9 @@ module function anisobrittle_init(source_length) result(mySources) if (any(prm%s_crit < 0.0_pReal)) extmsg = trim(extmsg)//' s_crit' Nconstituents = count(material_phaseAt==p) * discretization_nIPs - call phase_allocateState(damageState(p)%p(sourceOffset),Nconstituents,1,1,0) - damageState(p)%p(sourceOffset)%atol = src%get_asFloat('anisobrittle_atol',defaultVal=1.0e-3_pReal) - if(any(damageState(p)%p(sourceOffset)%atol < 0.0_pReal)) extmsg = trim(extmsg)//' anisobrittle_atol' + call phase_allocateState(damageState(p),Nconstituents,1,1,0) + damageState(p)%atol = src%get_asFloat('anisobrittle_atol',defaultVal=1.0e-3_pReal) + if(any(damageState(p)%atol < 0.0_pReal)) extmsg = trim(extmsg)//' anisobrittle_atol' end associate @@ -139,14 +136,13 @@ module subroutine anisobrittle_dotState(S, co, ip, el) real(pReal) :: & traction_d, traction_t, traction_n, traction_crit + ph = material_phaseAt(co,el) me = material_phasememberAt(co,ip,el) - sourceOffset = source_damage_anisoBrittle_offset(ph) - homog = material_homogenizationAt(el) - damageOffset = material_homogenizationMemberAt(ip,el) + associate(prm => param(source_damage_anisoBrittle_instance(ph))) - damageState(ph)%p(sourceOffset)%dotState(1,me) = 0.0_pReal + damageState(ph)%dotState(1,me) = 0.0_pReal do i = 1, prm%sum_N_cl traction_d = math_tensordot(S,prm%cleavage_systems(1:3,1:3,1,i)) traction_t = math_tensordot(S,prm%cleavage_systems(1:3,1:3,2,i)) @@ -154,8 +150,8 @@ module subroutine anisobrittle_dotState(S, co, ip, el) traction_crit = prm%g_crit(i)*phase_damage_get_phi(co,ip,el)**2.0_pReal - damageState(ph)%p(sourceOffset)%dotState(1,me) & - = damageState(ph)%p(sourceOffset)%dotState(1,me) & + damageState(ph)%dotState(1,me) & + = damageState(ph)%dotState(1,me) & + prm%dot_o / prm%s_crit(i) & * ((max(0.0_pReal, abs(traction_d) - traction_crit)/traction_crit)**prm%q + & (max(0.0_pReal, abs(traction_t) - traction_crit)/traction_crit)**prm%q + & @@ -180,12 +176,8 @@ module subroutine source_damage_anisobrittle_getRateAndItsTangent(localphiDot, d localphiDot, & dLocalphiDot_dPhi - integer :: & - sourceOffset - sourceOffset = source_damage_anisoBrittle_offset(phase) - - dLocalphiDot_dPhi = -damageState(phase)%p(sourceOffset)%state(1,constituent) + dLocalphiDot_dPhi = -damageState(phase)%state(1,constituent) localphiDot = 1.0_pReal & + dLocalphiDot_dPhi*phi @@ -204,7 +196,7 @@ module subroutine anisobrittle_results(phase,group) integer :: o associate(prm => param(source_damage_anisoBrittle_instance(phase)), & - stt => damageState(phase)%p(source_damage_anisoBrittle_offset(phase))%state) + stt => damageState(phase)%state) outputsLoop: do o = 1,size(prm%output) select case(trim(prm%output(o))) case ('f_phi') diff --git a/src/phase_damage_anisoductile.f90 b/src/phase_damage_anisoductile.f90 index b22f5b3d6..bafcf80a2 100644 --- a/src/phase_damage_anisoductile.f90 +++ b/src/phase_damage_anisoductile.f90 @@ -7,7 +7,6 @@ submodule(phase:damagee) anisoductile integer, dimension(:), allocatable :: & - source_damage_anisoDuctile_offset, & !< which source is my current damage mechanism? source_damage_anisoDuctile_instance !< instance of damage source mechanism type :: tParameters !< container type for internal constitutive parameters @@ -53,7 +52,6 @@ module function anisoductile_init(source_length) result(mySources) phases => config_material%get('phase') allocate(param(Ninstances)) - allocate(source_damage_anisoDuctile_offset (phases%length), source=0) allocate(source_damage_anisoDuctile_instance(phases%length), source=0) do p = 1, phases%length @@ -65,7 +63,6 @@ module function anisoductile_init(source_length) result(mySources) sources => phase%get('source') do sourceOffset = 1, sources%length if(mySources(sourceOffset,p)) then - source_damage_anisoDuctile_offset(p) = sourceOffset associate(prm => param(source_damage_anisoDuctile_instance(p))) src => sources%get(sourceOffset) @@ -87,9 +84,9 @@ module function anisoductile_init(source_length) result(mySources) if (any(prm%gamma_crit < 0.0_pReal)) extmsg = trim(extmsg)//' gamma_crit' Nconstituents=count(material_phaseAt==p) * discretization_nIPs - call phase_allocateState(damageState(p)%p(sourceOffset),Nconstituents,1,1,0) - damageState(p)%p(sourceOffset)%atol = src%get_asFloat('anisoDuctile_atol',defaultVal=1.0e-3_pReal) - if(any(damageState(p)%p(sourceOffset)%atol < 0.0_pReal)) extmsg = trim(extmsg)//' anisoductile_atol' + call phase_allocateState(damageState(p),Nconstituents,1,1,0) + damageState(p)%atol = src%get_asFloat('anisoDuctile_atol',defaultVal=1.0e-3_pReal) + if(any(damageState(p)%atol < 0.0_pReal)) extmsg = trim(extmsg)//' anisoductile_atol' end associate @@ -116,20 +113,14 @@ module subroutine anisoductile_dotState(co, ip, el) integer :: & ph, & - me, & - sourceOffset, & - damageOffset, & - homog + me ph = material_phaseAt(co,el) me = material_phasememberAt(co,ip,el) - sourceOffset = source_damage_anisoDuctile_offset(ph) - homog = material_homogenizationAt(el) - damageOffset = material_homogenizationMemberAt(ip,el) + associate(prm => param(source_damage_anisoDuctile_instance(ph))) - damageState(ph)%p(sourceOffset)%dotState(1,me) & - = sum(plasticState(ph)%slipRate(:,me)/(phase_damage_get_phi(co,ip,el)**prm%q)/prm%gamma_crit) + damageState(ph)%dotState(1,me) = sum(plasticState(ph)%slipRate(:,me)/(phase_damage_get_phi(co,ip,el)**prm%q)/prm%gamma_crit) end associate end subroutine anisoductile_dotState @@ -149,12 +140,8 @@ module subroutine source_damage_anisoDuctile_getRateAndItsTangent(localphiDot, d localphiDot, & dLocalphiDot_dPhi - integer :: & - sourceOffset - sourceOffset = source_damage_anisoDuctile_offset(phase) - - dLocalphiDot_dPhi = -damageState(phase)%p(sourceOffset)%state(1,constituent) + dLocalphiDot_dPhi = -damageState(phase)%state(1,constituent) localphiDot = 1.0_pReal & + dLocalphiDot_dPhi*phi @@ -173,7 +160,7 @@ module subroutine anisoductile_results(phase,group) integer :: o associate(prm => param(source_damage_anisoDuctile_instance(phase)), & - stt => damageState(phase)%p(source_damage_anisoDuctile_offset(phase))%state) + stt => damageState(phase)%state) outputsLoop: do o = 1,size(prm%output) select case(trim(prm%output(o))) case ('f_phi') diff --git a/src/phase_damage_isobrittle.f90 b/src/phase_damage_isobrittle.f90 index a2ae7dfb7..0a87493a6 100644 --- a/src/phase_damage_isobrittle.f90 +++ b/src/phase_damage_isobrittle.f90 @@ -7,7 +7,6 @@ submodule(phase:damagee) isobrittle integer, dimension(:), allocatable :: & - source_damage_isoBrittle_offset, & source_damage_isoBrittle_instance type :: tParameters !< container type for internal constitutive parameters @@ -48,7 +47,6 @@ module function isobrittle_init(source_length) result(mySources) phases => config_material%get('phase') allocate(param(Ninstances)) - allocate(source_damage_isoBrittle_offset (phases%length), source=0) allocate(source_damage_isoBrittle_instance(phases%length), source=0) do p = 1, phases%length @@ -58,7 +56,6 @@ module function isobrittle_init(source_length) result(mySources) sources => phase%get('damage') do sourceOffset = 1, sources%length if(mySources(sourceOffset,p)) then - source_damage_isoBrittle_offset(p) = sourceOffset associate(prm => param(source_damage_isoBrittle_instance(p))) src => sources%get(sourceOffset) @@ -74,9 +71,9 @@ module function isobrittle_init(source_length) result(mySources) if (prm%W_crit <= 0.0_pReal) extmsg = trim(extmsg)//' W_crit' Nconstituents = count(material_phaseAt==p) * discretization_nIPs - call phase_allocateState(damageState(p)%p(sourceOffset),Nconstituents,1,1,1) - damageState(p)%p(sourceOffset)%atol = src%get_asFloat('isoBrittle_atol',defaultVal=1.0e-3_pReal) - if(any(damageState(p)%p(sourceOffset)%atol < 0.0_pReal)) extmsg = trim(extmsg)//' isobrittle_atol' + call phase_allocateState(damageState(p),Nconstituents,1,1,1) + damageState(p)%atol = src%get_asFloat('isoBrittle_atol',defaultVal=1.0e-3_pReal) + if(any(damageState(p)%atol < 0.0_pReal)) extmsg = trim(extmsg)//' isobrittle_atol' end associate @@ -102,14 +99,11 @@ module subroutine source_damage_isoBrittle_deltaState(C, Fe, ph,me) real(pReal), intent(in), dimension(6,6) :: & C - integer :: & - sourceOffset real(pReal), dimension(6) :: & strain real(pReal) :: & strainenergy - sourceOffset = source_damage_isoBrittle_offset(ph) strain = 0.5_pReal*math_sym33to6(matmul(transpose(Fe),Fe)-math_I3) @@ -117,14 +111,11 @@ module subroutine source_damage_isoBrittle_deltaState(C, Fe, ph,me) strainenergy = 2.0_pReal*sum(strain*matmul(C,strain))/prm%W_crit ! ToDo: check strainenergy = 2.0_pReal*dot_product(strain,matmul(C,strain))/prm%W_crit - if (strainenergy > damageState(ph)%p(sourceOffset)%subState0(1,me)) then - damageState(ph)%p(sourceOffset)%deltaState(1,me) = & - strainenergy - damageState(ph)%p(sourceOffset)%state(1,me) - else - damageState(ph)%p(sourceOffset)%deltaState(1,me) = & - damageState(ph)%p(sourceOffset)%subState0(1,me) - & - damageState(ph)%p(sourceOffset)%state(1,me) - endif + if (strainenergy > damageState(ph)%subState0(1,me)) then + damageState(ph)%deltaState(1,me) = strainenergy - damageState(ph)%state(1,me) + else + damageState(ph)%deltaState(1,me) = damageState(ph)%subState0(1,me) - damageState(ph)%state(1,me) + endif end associate end subroutine source_damage_isoBrittle_deltaState @@ -144,15 +135,11 @@ module subroutine source_damage_isoBrittle_getRateAndItsTangent(localphiDot, dLo localphiDot, & dLocalphiDot_dPhi - integer :: & - sourceOffset - - sourceOffset = source_damage_isoBrittle_offset(phase) associate(prm => param(source_damage_isoBrittle_instance(phase))) - localphiDot = 1.0_pReal & - - phi*damageState(phase)%p(sourceOffset)%state(1,constituent) - dLocalphiDot_dPhi = - damageState(phase)%p(sourceOffset)%state(1,constituent) + localphiDot = 1.0_pReal & + - phi*damageState(phase)%state(1,constituent) + dLocalphiDot_dPhi = - damageState(phase)%state(1,constituent) end associate end subroutine source_damage_isoBrittle_getRateAndItsTangent @@ -169,7 +156,7 @@ module subroutine isobrittle_results(phase,group) integer :: o associate(prm => param(source_damage_isoBrittle_instance(phase)), & - stt => damageState(phase)%p(source_damage_isoBrittle_offset(phase))%state) + stt => damageState(phase)%state) outputsLoop: do o = 1,size(prm%output) select case(trim(prm%output(o))) case ('f_phi') diff --git a/src/phase_damage_isoductile.f90 b/src/phase_damage_isoductile.f90 index f378b7ad2..657f9da39 100644 --- a/src/phase_damage_isoductile.f90 +++ b/src/phase_damage_isoductile.f90 @@ -7,7 +7,6 @@ submodule(phase:damagee) isoductile integer, dimension(:), allocatable :: & - source_damage_isoDuctile_offset, & !< which source is my current damage mechanism? source_damage_isoDuctile_instance !< instance of damage source mechanism type:: tParameters !< container type for internal constitutive parameters @@ -50,7 +49,6 @@ module function isoductile_init(source_length) result(mySources) phases => config_material%get('phase') allocate(param(Ninstances)) - allocate(source_damage_isoDuctile_offset (phases%length), source=0) allocate(source_damage_isoDuctile_instance(phases%length), source=0) do p = 1, phases%length @@ -60,7 +58,6 @@ module function isoductile_init(source_length) result(mySources) sources => phase%get('damage') do sourceOffset = 1, sources%length if(mySources(sourceOffset,p)) then - source_damage_isoDuctile_offset(p) = sourceOffset associate(prm => param(source_damage_isoDuctile_instance(p))) src => sources%get(sourceOffset) @@ -78,9 +75,9 @@ module function isoductile_init(source_length) result(mySources) if (prm%gamma_crit <= 0.0_pReal) extmsg = trim(extmsg)//' gamma_crit' Nconstituents=count(material_phaseAt==p) * discretization_nIPs - call phase_allocateState(damageState(p)%p(sourceOffset),Nconstituents,1,1,0) - damageState(p)%p(sourceOffset)%atol = src%get_asFloat('isoDuctile_atol',defaultVal=1.0e-3_pReal) - if(any(damageState(p)%p(sourceOffset)%atol < 0.0_pReal)) extmsg = trim(extmsg)//' isoductile_atol' + call phase_allocateState(damageState(p),Nconstituents,1,1,0) + damageState(p)%atol = src%get_asFloat('isoDuctile_atol',defaultVal=1.0e-3_pReal) + if(any(damageState(p)%atol < 0.0_pReal)) extmsg = trim(extmsg)//' isoductile_atol' end associate @@ -107,20 +104,14 @@ module subroutine isoductile_dotState(co, ip, el) integer :: & ph, & - me, & - sourceOffset, & - damageOffset, & - homog + me ph = material_phaseAt(co,el) me = material_phasememberAt(co,ip,el) - sourceOffset = source_damage_isoDuctile_offset(ph) - homog = material_homogenizationAt(el) - damageOffset = material_homogenizationMemberAt(ip,el) + associate(prm => param(source_damage_isoDuctile_instance(ph))) - damageState(ph)%p(sourceOffset)%dotState(1,me) = & - sum(plasticState(ph)%slipRate(:,me))/(phase_damage_get_phi(co,ip,el)**prm%q)/prm%gamma_crit + damageState(ph)%dotState(1,me) = sum(plasticState(ph)%slipRate(:,me))/(phase_damage_get_phi(co,ip,el)**prm%q)/prm%gamma_crit end associate end subroutine isoductile_dotState @@ -140,12 +131,8 @@ module subroutine source_damage_isoDuctile_getRateAndItsTangent(localphiDot, dLo localphiDot, & dLocalphiDot_dPhi - integer :: & - sourceOffset - sourceOffset = source_damage_isoDuctile_offset(phase) - - dLocalphiDot_dPhi = -damageState(phase)%p(sourceOffset)%state(1,constituent) + dLocalphiDot_dPhi = -damageState(phase)%state(1,constituent) localphiDot = 1.0_pReal & + dLocalphiDot_dPhi*phi @@ -164,7 +151,7 @@ module subroutine isoductile_results(phase,group) integer :: o associate(prm => param(source_damage_isoDuctile_instance(phase)), & - stt => damageState(phase)%p(source_damage_isoDuctile_offset(phase))%state) + stt => damageState(phase)%state) outputsLoop: do o = 1,size(prm%output) select case(trim(prm%output(o))) case ('f_phi') diff --git a/src/phase_mechanical.f90 b/src/phase_mechanical.f90 index f7631a38d..bc4b2cd47 100644 --- a/src/phase_mechanical.f90 +++ b/src/phase_mechanical.f90 @@ -1138,7 +1138,7 @@ module function crystallite_stress(dt,co,ip,el) result(converged_) real(pReal) :: & formerSubStep integer :: & - so, ph, me, sizeDotState + ph, me, sizeDotState logical :: todo real(pReal) :: subFrac,subStep real(pReal), dimension(3,3) :: & @@ -1159,10 +1159,9 @@ module function crystallite_stress(dt,co,ip,el) result(converged_) subLp0 = phase_mechanical_Lp0(ph)%data(1:3,1:3,me) subState0 = plasticState(ph)%State0(:,me) + if (phase_Nsources(ph) > 0) & + damageState(ph)%subState0(:,me) = damageState(ph)%state0(:,me) - do so = 1, phase_Nsources(ph) - damageState(ph)%p(so)%subState0(:,me) = damageState(ph)%p(so)%state0(:,me) - enddo subFp0 = phase_mechanical_Fp0(ph)%data(1:3,1:3,me) subFi0 = phase_mechanical_Fi0(ph)%data(1:3,1:3,me) subF0 = phase_mechanical_F0(ph)%data(1:3,1:3,me) @@ -1188,9 +1187,9 @@ module function crystallite_stress(dt,co,ip,el) result(converged_) subFp0 = phase_mechanical_Fp(ph)%data(1:3,1:3,me) subFi0 = phase_mechanical_Fi(ph)%data(1:3,1:3,me) subState0 = plasticState(ph)%state(:,me) - do so = 1, phase_Nsources(ph) - damageState(ph)%p(so)%subState0(:,me) = damageState(ph)%p(so)%state(:,me) - enddo + if (phase_Nsources(ph) > 0) & + damageState(ph)%subState0(:,me) = damageState(ph)%state(:,me) + endif !-------------------------------------------------------------------------------------------------- ! cut back (reduced time and restore) @@ -1204,9 +1203,8 @@ module function crystallite_stress(dt,co,ip,el) result(converged_) phase_mechanical_Li(ph)%data(1:3,1:3,me) = subLi0 endif plasticState(ph)%state(:,me) = subState0 - do so = 1, phase_Nsources(ph) - damageState(ph)%p(so)%state(:,me) = damageState(ph)%p(so)%subState0(:,me) - enddo + if (phase_Nsources(ph) > 0) & + damageState(ph)%state(:,me) = damageState(ph)%subState0(:,me) todo = subStep > num%subStepMinCryst ! still on track or already done (beyond repair) endif From 775a51faa11ae9d75d85cdf30e583e8f5dcc4966 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sat, 13 Feb 2021 10:11:39 +0100 Subject: [PATCH 35/60] explicit instance mapping not needed --- src/phase_damage_anisobrittle.f90 | 52 ++++++++++++++----------------- src/phase_damage_anisoductile.f90 | 29 +++++++---------- src/phase_damage_isobrittle.f90 | 32 +++++++++---------- src/phase_damage_isoductile.f90 | 28 +++++++---------- 4 files changed, 60 insertions(+), 81 deletions(-) diff --git a/src/phase_damage_anisobrittle.f90 b/src/phase_damage_anisobrittle.f90 index 422b2a91a..81072e16d 100644 --- a/src/phase_damage_anisobrittle.f90 +++ b/src/phase_damage_anisobrittle.f90 @@ -6,9 +6,6 @@ !-------------------------------------------------------------------------------------------------- submodule (phase:damagee) anisobrittle - integer, dimension(:), allocatable :: & - source_damage_anisoBrittle_instance !< instance of source mechanism - type :: tParameters !< container type for internal constitutive parameters real(pReal) :: & dot_o, & !< opening rate of cleavage planes @@ -56,17 +53,16 @@ module function anisobrittle_init(source_length) result(mySources) if(Ninstances == 0) return phases => config_material%get('phase') - allocate(param(Ninstances)) - allocate(source_damage_anisoBrittle_instance(phases%length), source=0) + allocate(param(phases%length)) + do p = 1, phases%length phase => phases%get(p) - if(any(mySources(:,p))) source_damage_anisoBrittle_instance(p) = count(mySources(:,1:p)) if(count(mySources(:,p)) == 0) cycle sources => phase%get('damage') do sourceOffset = 1, sources%length if(mySources(sourceOffset,p)) then - associate(prm => param(source_damage_anisoBrittle_instance(p))) + associate(prm => param(p)) src => sources%get(sourceOffset) N_cl = src%get_asInts('N_cl',defaultVal=emptyIntArray) @@ -141,22 +137,21 @@ module subroutine anisobrittle_dotState(S, co, ip, el) me = material_phasememberAt(co,ip,el) - associate(prm => param(source_damage_anisoBrittle_instance(ph))) - damageState(ph)%dotState(1,me) = 0.0_pReal - do i = 1, prm%sum_N_cl - traction_d = math_tensordot(S,prm%cleavage_systems(1:3,1:3,1,i)) - traction_t = math_tensordot(S,prm%cleavage_systems(1:3,1:3,2,i)) - traction_n = math_tensordot(S,prm%cleavage_systems(1:3,1:3,3,i)) + associate(prm => param(ph)) + damageState(ph)%dotState(1,me) = 0.0_pReal + do i = 1, prm%sum_N_cl + traction_d = math_tensordot(S,prm%cleavage_systems(1:3,1:3,1,i)) + traction_t = math_tensordot(S,prm%cleavage_systems(1:3,1:3,2,i)) + traction_n = math_tensordot(S,prm%cleavage_systems(1:3,1:3,3,i)) - traction_crit = prm%g_crit(i)*phase_damage_get_phi(co,ip,el)**2.0_pReal + traction_crit = prm%g_crit(i)*phase_damage_get_phi(co,ip,el)**2.0_pReal - damageState(ph)%dotState(1,me) & - = damageState(ph)%dotState(1,me) & - + prm%dot_o / prm%s_crit(i) & - * ((max(0.0_pReal, abs(traction_d) - traction_crit)/traction_crit)**prm%q + & - (max(0.0_pReal, abs(traction_t) - traction_crit)/traction_crit)**prm%q + & - (max(0.0_pReal, abs(traction_n) - traction_crit)/traction_crit)**prm%q) - enddo + damageState(ph)%dotState(1,me) = damageState(ph)%dotState(1,me) & + + prm%dot_o / prm%s_crit(i) & + * ((max(0.0_pReal, abs(traction_d) - traction_crit)/traction_crit)**prm%q + & + (max(0.0_pReal, abs(traction_t) - traction_crit)/traction_crit)**prm%q + & + (max(0.0_pReal, abs(traction_n) - traction_crit)/traction_crit)**prm%q) + enddo end associate end subroutine anisobrittle_dotState @@ -195,14 +190,13 @@ module subroutine anisobrittle_results(phase,group) integer :: o - associate(prm => param(source_damage_anisoBrittle_instance(phase)), & - stt => damageState(phase)%state) - outputsLoop: do o = 1,size(prm%output) - select case(trim(prm%output(o))) - case ('f_phi') - call results_writeDataset(group,stt,trim(prm%output(o)),'driving force','J/m³') - end select - enddo outputsLoop + associate(prm => param(phase), stt => damageState(phase)%state) + outputsLoop: do o = 1,size(prm%output) + select case(trim(prm%output(o))) + case ('f_phi') + call results_writeDataset(group,stt,trim(prm%output(o)),'driving force','J/m³') + end select + enddo outputsLoop end associate end subroutine anisobrittle_results diff --git a/src/phase_damage_anisoductile.f90 b/src/phase_damage_anisoductile.f90 index bafcf80a2..4d2392589 100644 --- a/src/phase_damage_anisoductile.f90 +++ b/src/phase_damage_anisoductile.f90 @@ -6,9 +6,6 @@ !-------------------------------------------------------------------------------------------------- submodule(phase:damagee) anisoductile - integer, dimension(:), allocatable :: & - source_damage_anisoDuctile_instance !< instance of damage source mechanism - type :: tParameters !< container type for internal constitutive parameters real(pReal) :: & q !< damage rate sensitivity @@ -18,7 +15,7 @@ submodule(phase:damagee) anisoductile output end type tParameters - type(tParameters), dimension(:), allocatable :: param !< containers of constitutive parameters (len Ninstances) + type(tParameters), dimension(:), allocatable :: param !< containers of constitutive parameters contains @@ -51,19 +48,17 @@ module function anisoductile_init(source_length) result(mySources) if(Ninstances == 0) return phases => config_material%get('phase') - allocate(param(Ninstances)) - allocate(source_damage_anisoDuctile_instance(phases%length), source=0) + allocate(param(phases%length)) do p = 1, phases%length phase => phases%get(p) - if(any(mySources(:,p))) source_damage_anisoDuctile_instance(p) = count(mySources(:,1:p)) if(count(mySources(:,p)) == 0) cycle mech => phase%get('mechanics') pl => mech%get('plasticity') sources => phase%get('source') do sourceOffset = 1, sources%length if(mySources(sourceOffset,p)) then - associate(prm => param(source_damage_anisoDuctile_instance(p))) + associate(prm => param(p)) src => sources%get(sourceOffset) N_sl = pl%get_asInts('N_sl',defaultVal=emptyIntArray) @@ -119,8 +114,8 @@ module subroutine anisoductile_dotState(co, ip, el) me = material_phasememberAt(co,ip,el) - associate(prm => param(source_damage_anisoDuctile_instance(ph))) - damageState(ph)%dotState(1,me) = sum(plasticState(ph)%slipRate(:,me)/(phase_damage_get_phi(co,ip,el)**prm%q)/prm%gamma_crit) + associate(prm => param(ph)) + damageState(ph)%dotState(1,me) = sum(plasticState(ph)%slipRate(:,me)/(damage_phi(ph,me)**prm%q)/prm%gamma_crit) end associate end subroutine anisoductile_dotState @@ -159,14 +154,14 @@ module subroutine anisoductile_results(phase,group) integer :: o - associate(prm => param(source_damage_anisoDuctile_instance(phase)), & + associate(prm => param(phase), & stt => damageState(phase)%state) - outputsLoop: do o = 1,size(prm%output) - select case(trim(prm%output(o))) - case ('f_phi') - call results_writeDataset(group,stt,trim(prm%output(o)),'driving force','J/m³') - end select - enddo outputsLoop + outputsLoop: do o = 1,size(prm%output) + select case(trim(prm%output(o))) + case ('f_phi') + call results_writeDataset(group,stt,trim(prm%output(o)),'driving force','J/m³') + end select + enddo outputsLoop end associate end subroutine anisoductile_results diff --git a/src/phase_damage_isobrittle.f90 b/src/phase_damage_isobrittle.f90 index 0a87493a6..4e37f3ee9 100644 --- a/src/phase_damage_isobrittle.f90 +++ b/src/phase_damage_isobrittle.f90 @@ -6,9 +6,6 @@ !-------------------------------------------------------------------------------------------------- submodule(phase:damagee) isobrittle - integer, dimension(:), allocatable :: & - source_damage_isoBrittle_instance - type :: tParameters !< container type for internal constitutive parameters real(pReal) :: & W_crit !< critical elastic strain energy @@ -46,17 +43,15 @@ module function isobrittle_init(source_length) result(mySources) if(Ninstances == 0) return phases => config_material%get('phase') - allocate(param(Ninstances)) - allocate(source_damage_isoBrittle_instance(phases%length), source=0) + allocate(param(phases%length)) do p = 1, phases%length phase => phases%get(p) - if(any(mySources(:,p))) source_damage_isoBrittle_instance(p) = count(mySources(:,1:p)) if(count(mySources(:,p)) == 0) cycle sources => phase%get('damage') do sourceOffset = 1, sources%length if(mySources(sourceOffset,p)) then - associate(prm => param(source_damage_isoBrittle_instance(p))) + associate(prm => param(p)) src => sources%get(sourceOffset) prm%W_crit = src%get_asFloat('W_crit') @@ -107,9 +102,9 @@ module subroutine source_damage_isoBrittle_deltaState(C, Fe, ph,me) strain = 0.5_pReal*math_sym33to6(matmul(transpose(Fe),Fe)-math_I3) - associate(prm => param(source_damage_isoBrittle_instance(ph))) - strainenergy = 2.0_pReal*sum(strain*matmul(C,strain))/prm%W_crit - ! ToDo: check strainenergy = 2.0_pReal*dot_product(strain,matmul(C,strain))/prm%W_crit + associate(prm => param(ph)) + strainenergy = 2.0_pReal*sum(strain*matmul(C,strain))/prm%W_crit + ! ToDo: check strainenergy = 2.0_pReal*dot_product(strain,matmul(C,strain))/prm%W_crit if (strainenergy > damageState(ph)%subState0(1,me)) then damageState(ph)%deltaState(1,me) = strainenergy - damageState(ph)%state(1,me) @@ -136,7 +131,7 @@ module subroutine source_damage_isoBrittle_getRateAndItsTangent(localphiDot, dLo dLocalphiDot_dPhi - associate(prm => param(source_damage_isoBrittle_instance(phase))) + associate(prm => param(phase)) localphiDot = 1.0_pReal & - phi*damageState(phase)%state(1,constituent) dLocalphiDot_dPhi = - damageState(phase)%state(1,constituent) @@ -155,14 +150,15 @@ module subroutine isobrittle_results(phase,group) integer :: o - associate(prm => param(source_damage_isoBrittle_instance(phase)), & + + associate(prm => param(phase), & stt => damageState(phase)%state) - outputsLoop: do o = 1,size(prm%output) - select case(trim(prm%output(o))) - case ('f_phi') - call results_writeDataset(group,stt,trim(prm%output(o)),'driving force','J/m³') - end select - enddo outputsLoop + outputsLoop: do o = 1,size(prm%output) + select case(trim(prm%output(o))) + case ('f_phi') + call results_writeDataset(group,stt,trim(prm%output(o)),'driving force','J/m³') + end select + enddo outputsLoop end associate end subroutine isobrittle_results diff --git a/src/phase_damage_isoductile.f90 b/src/phase_damage_isoductile.f90 index 657f9da39..89211b746 100644 --- a/src/phase_damage_isoductile.f90 +++ b/src/phase_damage_isoductile.f90 @@ -6,9 +6,6 @@ !-------------------------------------------------------------------------------------------------- submodule(phase:damagee) isoductile - integer, dimension(:), allocatable :: & - source_damage_isoDuctile_instance !< instance of damage source mechanism - type:: tParameters !< container type for internal constitutive parameters real(pReal) :: & gamma_crit, & !< critical plastic strain @@ -48,17 +45,15 @@ module function isoductile_init(source_length) result(mySources) if(Ninstances == 0) return phases => config_material%get('phase') - allocate(param(Ninstances)) - allocate(source_damage_isoDuctile_instance(phases%length), source=0) + allocate(param(phases%length)) do p = 1, phases%length phase => phases%get(p) if(count(mySources(:,p)) == 0) cycle - if(any(mySources(:,p))) source_damage_isoDuctile_instance(p) = count(mySources(:,1:p)) sources => phase%get('damage') do sourceOffset = 1, sources%length if(mySources(sourceOffset,p)) then - associate(prm => param(source_damage_isoDuctile_instance(p))) + associate(prm => param(p)) src => sources%get(sourceOffset) prm%q = src%get_asFloat('q') @@ -110,8 +105,8 @@ module subroutine isoductile_dotState(co, ip, el) me = material_phasememberAt(co,ip,el) - associate(prm => param(source_damage_isoDuctile_instance(ph))) - damageState(ph)%dotState(1,me) = sum(plasticState(ph)%slipRate(:,me))/(phase_damage_get_phi(co,ip,el)**prm%q)/prm%gamma_crit + associate(prm => param(ph)) + damageState(ph)%dotState(1,me) = sum(plasticState(ph)%slipRate(:,me))/(damage_phi(ph,me)**prm%q)/prm%gamma_crit end associate end subroutine isoductile_dotState @@ -150,14 +145,13 @@ module subroutine isoductile_results(phase,group) integer :: o - associate(prm => param(source_damage_isoDuctile_instance(phase)), & - stt => damageState(phase)%state) - outputsLoop: do o = 1,size(prm%output) - select case(trim(prm%output(o))) - case ('f_phi') - call results_writeDataset(group,stt,trim(prm%output(o)),'driving force','J/m³') - end select - enddo outputsLoop + associate(prm => param(phase), stt => damageState(phase)%state) + outputsLoop: do o = 1,size(prm%output) + select case(trim(prm%output(o))) + case ('f_phi') + call results_writeDataset(group,stt,trim(prm%output(o)),'driving force','J/m³') + end select + enddo outputsLoop end associate end subroutine isoductile_results From d9699b0f2e2c5126871f62b4ad8ab3183fd14b1d Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sat, 13 Feb 2021 11:01:08 +0100 Subject: [PATCH 36/60] simplified access pattern --- src/phase_damage.f90 | 92 ++++++++++++------------------- src/phase_damage_anisobrittle.f90 | 25 +++------ src/phase_damage_anisoductile.f90 | 24 +++----- src/phase_damage_isobrittle.f90 | 25 ++++----- src/phase_damage_isoductile.f90 | 23 +++----- 5 files changed, 71 insertions(+), 118 deletions(-) diff --git a/src/phase_damage.f90 b/src/phase_damage.f90 index 5f323c3a2..803a9251d 100644 --- a/src/phase_damage.f90 +++ b/src/phase_damage.f90 @@ -43,82 +43,65 @@ submodule(phase) damagee end function isoductile_init - module subroutine source_damage_isoBrittle_deltaState(C, Fe, ph, me) + module subroutine isobrittle_deltaState(C, Fe, ph, me) integer, intent(in) :: ph,me real(pReal), intent(in), dimension(3,3) :: & Fe real(pReal), intent(in), dimension(6,6) :: & C - end subroutine source_damage_isoBrittle_deltaState + end subroutine isobrittle_deltaState - module subroutine anisobrittle_dotState(S, co, ip, el) - integer, intent(in) :: & - co, & !< component-ID of integration point - ip, & !< integration point - el !< element + module subroutine anisobrittle_dotState(S, ph, me) + integer, intent(in) :: ph,me real(pReal), intent(in), dimension(3,3) :: & S end subroutine anisobrittle_dotState - module subroutine anisoductile_dotState(co, ip, el) - integer, intent(in) :: & - co, & !< component-ID of integration point - ip, & !< integration point - el !< element + module subroutine anisoductile_dotState(ph,me) + integer, intent(in) :: ph,me end subroutine anisoductile_dotState - module subroutine isoductile_dotState(co, ip, el) - integer, intent(in) :: & - co, & !< component-ID of integration point - ip, & !< integration point - el !< element + module subroutine isoductile_dotState(ph,me) + integer, intent(in) :: ph,me end subroutine isoductile_dotState - module subroutine source_damage_anisobrittle_getRateAndItsTangent(localphiDot, dLocalphiDot_dPhi, phi, phase, constituent) - integer, intent(in) :: & - phase, & !< phase ID of element - constituent !< position of element within its phase instance + module subroutine anisobrittle_getRateAndItsTangent(localphiDot, dLocalphiDot_dPhi, phi, ph, me) + integer, intent(in) :: ph,me real(pReal), intent(in) :: & phi !< damage parameter real(pReal), intent(out) :: & localphiDot, & dLocalphiDot_dPhi - end subroutine source_damage_anisoBrittle_getRateAndItsTangent + end subroutine anisobrittle_getRateAndItsTangent - module subroutine source_damage_anisoDuctile_getRateAndItsTangent(localphiDot, dLocalphiDot_dPhi, phi, phase, constituent) - integer, intent(in) :: & - phase, & !< phase ID of element - constituent !< position of element within its phase instance + module subroutine anisoductile_getRateAndItsTangent(localphiDot, dLocalphiDot_dPhi, phi, ph,me) + integer, intent(in) :: ph,me real(pReal), intent(in) :: & phi !< damage parameter real(pReal), intent(out) :: & localphiDot, & dLocalphiDot_dPhi - end subroutine source_damage_anisoDuctile_getRateAndItsTangent + end subroutine anisoductile_getRateAndItsTangent - module subroutine source_damage_isoBrittle_getRateAndItsTangent(localphiDot, dLocalphiDot_dPhi, phi, phase, constituent) - integer, intent(in) :: & - phase, & !< phase ID of element - constituent !< position of element within its phase instance + module subroutine isobrittle_getRateAndItsTangent(localphiDot, dLocalphiDot_dPhi, phi, ph,me) + integer, intent(in) :: ph,me real(pReal), intent(in) :: & phi !< damage parameter real(pReal), intent(out) :: & localphiDot, & dLocalphiDot_dPhi - end subroutine source_damage_isoBrittle_getRateAndItsTangent + end subroutine isobrittle_getRateAndItsTangent - module subroutine source_damage_isoDuctile_getRateAndItsTangent(localphiDot, dLocalphiDot_dPhi, phi, phase, constituent) - integer, intent(in) :: & - phase, & !< phase ID of element - constituent !< position of element within its phase instance + module subroutine isoductile_getRateAndItsTangent(localphiDot, dLocalphiDot_dPhi, phi, ph,me) + integer, intent(in) :: ph,me real(pReal), intent(in) :: & phi !< damage parameter real(pReal), intent(out) :: & localphiDot, & dLocalphiDot_dPhi - end subroutine source_damage_isoDuctile_getRateAndItsTangent + end subroutine isoductile_getRateAndItsTangent module subroutine anisobrittle_results(phase,group) integer, intent(in) :: phase @@ -225,16 +208,16 @@ module subroutine phase_damage_getRateAndItsTangents(phiDot, dPhiDot_dPhi, phi, do so = 1, phase_Nsources(ph) select case(phase_source(so,ph)) case (DAMAGE_ISOBRITTLE_ID) - call source_damage_isobrittle_getRateAndItsTangent (localphiDot, dLocalphiDot_dPhi, phi, ph, me) + call isobrittle_getRateAndItsTangent (localphiDot, dLocalphiDot_dPhi, phi, ph, me) case (DAMAGE_ISODUCTILE_ID) - call source_damage_isoductile_getRateAndItsTangent (localphiDot, dLocalphiDot_dPhi, phi, ph, me) + call isoductile_getRateAndItsTangent (localphiDot, dLocalphiDot_dPhi, phi, ph, me) case (DAMAGE_ANISOBRITTLE_ID) - call source_damage_anisobrittle_getRateAndItsTangent(localphiDot, dLocalphiDot_dPhi, phi, ph, me) + call anisobrittle_getRateAndItsTangent(localphiDot, dLocalphiDot_dPhi, phi, ph, me) case (DAMAGE_ANISODUCTILE_ID) - call source_damage_anisoductile_getRateAndItsTangent(localphiDot, dLocalphiDot_dPhi, phi, ph, me) + call anisoductile_getRateAndItsTangent(localphiDot, dLocalphiDot_dPhi, phi, ph, me) case default localphiDot = 0.0_pReal @@ -281,7 +264,7 @@ module function integrateDamageState(dt,co,ip,el) result(broken) me = material_phaseMemberAt(co,ip,el) converged_ = .true. - broken = phase_damage_collectDotState(co,ip,el,ph,me) + broken = phase_damage_collectDotState(ph,me) if(broken) return size_so = damageState(ph)%sizeDotState @@ -294,7 +277,7 @@ module function integrateDamageState(dt,co,ip,el) result(broken) if(nIterationState > 1) source_dotState(1:size_so,2) = source_dotState(1:size_so,1) source_dotState(1:size_so,1) = damageState(ph)%dotState(:,me) - broken = phase_damage_collectDotState(co,ip,el,ph,me) + broken = phase_damage_collectDotState(ph,me) if(broken) exit iteration @@ -384,39 +367,34 @@ end subroutine damage_results !-------------------------------------------------------------------------------------------------- !> @brief contains the constitutive equation for calculating the rate of change of microstructure !-------------------------------------------------------------------------------------------------- -function phase_damage_collectDotState(co,ip,el,ph,me) result(broken) +function phase_damage_collectDotState(ph,me) result(broken) integer, intent(in) :: & - co, & !< component-ID me integration point - ip, & !< integration point - el, & !< element ph, & - me - integer :: & - so !< counter in source loop + me !< counter in source loop logical :: broken broken = .false. - SourceLoop: do so = 1, phase_Nsources(ph) + if (phase_Nsources(ph)==1) then - sourceType: select case (phase_source(so,ph)) + sourceType: select case (phase_source(1,ph)) case (DAMAGE_ISODUCTILE_ID) sourceType - call isoductile_dotState(co, ip, el) + call isoductile_dotState(ph,me) case (DAMAGE_ANISODUCTILE_ID) sourceType - call anisoductile_dotState(co, ip, el) + call anisoductile_dotState(ph,me) case (DAMAGE_ANISOBRITTLE_ID) sourceType - call anisobrittle_dotState(mechanical_S(ph,me),co, ip, el) ! correct stress? + call anisobrittle_dotState(mechanical_S(ph,me), ph,me) ! correct stress? end select sourceType broken = broken .or. any(IEEE_is_NaN(damageState(ph)%dotState(:,me))) - enddo SourceLoop + endif end function phase_damage_collectDotState @@ -447,7 +425,7 @@ function phase_damage_deltaState(Fe, ph, me) result(broken) sourceType: select case (phase_source(1,ph)) case (DAMAGE_ISOBRITTLE_ID) sourceType - call source_damage_isoBrittle_deltaState(phase_homogenizedC(ph,me), Fe, ph,me) + call isobrittle_deltaState(phase_homogenizedC(ph,me), Fe, ph,me) broken = any(IEEE_is_NaN(damageState(ph)%deltaState(:,me))) if(.not. broken) then myOffset = damageState(ph)%offsetDeltaState diff --git a/src/phase_damage_anisobrittle.f90 b/src/phase_damage_anisobrittle.f90 index 81072e16d..a121ee932 100644 --- a/src/phase_damage_anisobrittle.f90 +++ b/src/phase_damage_anisobrittle.f90 @@ -113,18 +113,14 @@ end function anisobrittle_init !-------------------------------------------------------------------------------------------------- !> @brief calculates derived quantities from state !-------------------------------------------------------------------------------------------------- -module subroutine anisobrittle_dotState(S, co, ip, el) +module subroutine anisobrittle_dotState(S, ph,me) integer, intent(in) :: & - co, & !< component-ID of integration point - ip, & !< integration point - el !< element + ph,me real(pReal), intent(in), dimension(3,3) :: & S integer :: & - ph, & - me, & sourceOffset, & damageOffset, & homog, & @@ -133,10 +129,6 @@ module subroutine anisobrittle_dotState(S, co, ip, el) traction_d, traction_t, traction_n, traction_crit - ph = material_phaseAt(co,el) - me = material_phasememberAt(co,ip,el) - - associate(prm => param(ph)) damageState(ph)%dotState(1,me) = 0.0_pReal do i = 1, prm%sum_N_cl @@ -144,7 +136,7 @@ module subroutine anisobrittle_dotState(S, co, ip, el) traction_t = math_tensordot(S,prm%cleavage_systems(1:3,1:3,2,i)) traction_n = math_tensordot(S,prm%cleavage_systems(1:3,1:3,3,i)) - traction_crit = prm%g_crit(i)*phase_damage_get_phi(co,ip,el)**2.0_pReal + traction_crit = prm%g_crit(i)*damage_phi(ph,me)**2.0_pReal damageState(ph)%dotState(1,me) = damageState(ph)%dotState(1,me) & + prm%dot_o / prm%s_crit(i) & @@ -160,11 +152,11 @@ end subroutine anisobrittle_dotState !-------------------------------------------------------------------------------------------------- !> @brief returns local part of nonlocal damage driving force !-------------------------------------------------------------------------------------------------- -module subroutine source_damage_anisobrittle_getRateAndItsTangent(localphiDot, dLocalphiDot_dPhi, phi, phase, constituent) +module subroutine anisobrittle_getRateAndItsTangent(localphiDot, dLocalphiDot_dPhi, phi, ph, me) integer, intent(in) :: & - phase, & - constituent + ph, & + me real(pReal), intent(in) :: & phi real(pReal), intent(out) :: & @@ -172,12 +164,12 @@ module subroutine source_damage_anisobrittle_getRateAndItsTangent(localphiDot, d dLocalphiDot_dPhi - dLocalphiDot_dPhi = -damageState(phase)%state(1,constituent) + dLocalphiDot_dPhi = -damageState(ph)%state(1,me) localphiDot = 1.0_pReal & + dLocalphiDot_dPhi*phi -end subroutine source_damage_anisoBrittle_getRateAndItsTangent +end subroutine anisobrittle_getRateAndItsTangent !-------------------------------------------------------------------------------------------------- @@ -190,6 +182,7 @@ module subroutine anisobrittle_results(phase,group) integer :: o + associate(prm => param(phase), stt => damageState(phase)%state) outputsLoop: do o = 1,size(prm%output) select case(trim(prm%output(o))) diff --git a/src/phase_damage_anisoductile.f90 b/src/phase_damage_anisoductile.f90 index 4d2392589..cf55e398b 100644 --- a/src/phase_damage_anisoductile.f90 +++ b/src/phase_damage_anisoductile.f90 @@ -99,20 +99,12 @@ end function anisoductile_init !-------------------------------------------------------------------------------------------------- !> @brief calculates derived quantities from state !-------------------------------------------------------------------------------------------------- -module subroutine anisoductile_dotState(co, ip, el) +module subroutine anisoductile_dotState(ph,me) integer, intent(in) :: & - co, & !< component-ID of integration point - ip, & !< integration point - el !< element - - integer :: & ph, & me - ph = material_phaseAt(co,el) - me = material_phasememberAt(co,ip,el) - associate(prm => param(ph)) damageState(ph)%dotState(1,me) = sum(plasticState(ph)%slipRate(:,me)/(damage_phi(ph,me)**prm%q)/prm%gamma_crit) @@ -124,11 +116,11 @@ end subroutine anisoductile_dotState !-------------------------------------------------------------------------------------------------- !> @brief returns local part of nonlocal damage driving force !-------------------------------------------------------------------------------------------------- -module subroutine source_damage_anisoDuctile_getRateAndItsTangent(localphiDot, dLocalphiDot_dPhi, phi, phase, constituent) +module subroutine anisoductile_getRateAndItsTangent(localphiDot, dLocalphiDot_dPhi, phi, ph,me) integer, intent(in) :: & - phase, & - constituent + ph, & + me real(pReal), intent(in) :: & phi real(pReal), intent(out) :: & @@ -136,12 +128,12 @@ module subroutine source_damage_anisoDuctile_getRateAndItsTangent(localphiDot, d dLocalphiDot_dPhi - dLocalphiDot_dPhi = -damageState(phase)%state(1,constituent) + dLocalphiDot_dPhi = -damageState(ph)%state(1,me) localphiDot = 1.0_pReal & + dLocalphiDot_dPhi*phi -end subroutine source_damage_anisoDuctile_getRateAndItsTangent +end subroutine anisoductile_getRateAndItsTangent !-------------------------------------------------------------------------------------------------- @@ -154,8 +146,8 @@ module subroutine anisoductile_results(phase,group) integer :: o - associate(prm => param(phase), & - stt => damageState(phase)%state) + + associate(prm => param(phase), stt => damageState(phase)%state) outputsLoop: do o = 1,size(prm%output) select case(trim(prm%output(o))) case ('f_phi') diff --git a/src/phase_damage_isobrittle.f90 b/src/phase_damage_isobrittle.f90 index 4e37f3ee9..e267ffcc9 100644 --- a/src/phase_damage_isobrittle.f90 +++ b/src/phase_damage_isobrittle.f90 @@ -86,7 +86,7 @@ end function isobrittle_init !-------------------------------------------------------------------------------------------------- !> @brief calculates derived quantities from state !-------------------------------------------------------------------------------------------------- -module subroutine source_damage_isoBrittle_deltaState(C, Fe, ph,me) +module subroutine isobrittle_deltaState(C, Fe, ph,me) integer, intent(in) :: ph,me real(pReal), intent(in), dimension(3,3) :: & @@ -106,24 +106,21 @@ module subroutine source_damage_isoBrittle_deltaState(C, Fe, ph,me) strainenergy = 2.0_pReal*sum(strain*matmul(C,strain))/prm%W_crit ! ToDo: check strainenergy = 2.0_pReal*dot_product(strain,matmul(C,strain))/prm%W_crit - if (strainenergy > damageState(ph)%subState0(1,me)) then - damageState(ph)%deltaState(1,me) = strainenergy - damageState(ph)%state(1,me) - else - damageState(ph)%deltaState(1,me) = damageState(ph)%subState0(1,me) - damageState(ph)%state(1,me) - endif + damageState(ph)%deltaState(1,me) = merge(strainenergy - damageState(ph)%state(1,me), & + damageState(ph)%subState0(1,me) - damageState(ph)%state(1,me), & + strainenergy > damageState(ph)%subState0(1,me)) end associate -end subroutine source_damage_isoBrittle_deltaState +end subroutine isobrittle_deltaState !-------------------------------------------------------------------------------------------------- !> @brief returns local part of nonlocal damage driving force !-------------------------------------------------------------------------------------------------- -module subroutine source_damage_isoBrittle_getRateAndItsTangent(localphiDot, dLocalphiDot_dPhi, phi, phase, constituent) +module subroutine isobrittle_getRateAndItsTangent(localphiDot, dLocalphiDot_dPhi, phi, ph, me) integer, intent(in) :: & - phase, & - constituent + ph, me real(pReal), intent(in) :: & phi real(pReal), intent(out) :: & @@ -131,13 +128,13 @@ module subroutine source_damage_isoBrittle_getRateAndItsTangent(localphiDot, dLo dLocalphiDot_dPhi - associate(prm => param(phase)) + associate(prm => param(ph)) localphiDot = 1.0_pReal & - - phi*damageState(phase)%state(1,constituent) - dLocalphiDot_dPhi = - damageState(phase)%state(1,constituent) + - phi*damageState(ph)%state(1,me) + dLocalphiDot_dPhi = - damageState(ph)%state(1,me) end associate -end subroutine source_damage_isoBrittle_getRateAndItsTangent +end subroutine isobrittle_getRateAndItsTangent !-------------------------------------------------------------------------------------------------- diff --git a/src/phase_damage_isoductile.f90 b/src/phase_damage_isoductile.f90 index 89211b746..f59952222 100644 --- a/src/phase_damage_isoductile.f90 +++ b/src/phase_damage_isoductile.f90 @@ -90,23 +90,16 @@ end function isoductile_init !-------------------------------------------------------------------------------------------------- !> @brief calculates derived quantities from state !-------------------------------------------------------------------------------------------------- -module subroutine isoductile_dotState(co, ip, el) +module subroutine isoductile_dotState(ph, me) integer, intent(in) :: & - co, & !< component-ID of integration point - ip, & !< integration point - el !< element - - integer :: & ph, & me - ph = material_phaseAt(co,el) - me = material_phasememberAt(co,ip,el) - associate(prm => param(ph)) - damageState(ph)%dotState(1,me) = sum(plasticState(ph)%slipRate(:,me))/(damage_phi(ph,me)**prm%q)/prm%gamma_crit + damageState(ph)%dotState(1,me) = sum(plasticState(ph)%slipRate(:,me)) & + / (prm%gamma_crit*damage_phi(ph,me)**prm%q) end associate end subroutine isoductile_dotState @@ -115,11 +108,11 @@ end subroutine isoductile_dotState !-------------------------------------------------------------------------------------------------- !> @brief returns local part of nonlocal damage driving force !-------------------------------------------------------------------------------------------------- -module subroutine source_damage_isoDuctile_getRateAndItsTangent(localphiDot, dLocalphiDot_dPhi, phi, phase, constituent) +module subroutine isoductile_getRateAndItsTangent(localphiDot, dLocalphiDot_dPhi, phi, ph, me) integer, intent(in) :: & - phase, & - constituent + ph, & + me real(pReal), intent(in) :: & phi real(pReal), intent(out) :: & @@ -127,12 +120,12 @@ module subroutine source_damage_isoDuctile_getRateAndItsTangent(localphiDot, dLo dLocalphiDot_dPhi - dLocalphiDot_dPhi = -damageState(phase)%state(1,constituent) + dLocalphiDot_dPhi = -damageState(ph)%state(1,me) localphiDot = 1.0_pReal & + dLocalphiDot_dPhi*phi -end subroutine source_damage_isoDuctile_getRateAndItsTangent +end subroutine isoductile_getRateAndItsTangent !-------------------------------------------------------------------------------------------------- From 570086c814c22062bfd7b9582b64d805c6ae970b Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sat, 13 Feb 2021 12:44:47 +0100 Subject: [PATCH 37/60] hard code at max 1 damage mechanism --- src/homogenization.f90 | 4 +- src/phase_damage.f90 | 61 ++++++++++++++----------------- src/phase_damage_anisobrittle.f90 | 18 ++++----- src/phase_damage_anisoductile.f90 | 29 +++++++-------- src/phase_damage_isobrittle.f90 | 20 +++++----- src/phase_damage_isoductile.f90 | 23 +++++------- 6 files changed, 70 insertions(+), 85 deletions(-) diff --git a/src/homogenization.f90 b/src/homogenization.f90 index 073482c9a..3e1b939b5 100644 --- a/src/homogenization.f90 +++ b/src/homogenization.f90 @@ -257,8 +257,8 @@ subroutine homogenization_init() allocate(homogState (size(material_name_homogenization))) allocate(damageState_h (size(material_name_homogenization))) - call material_parseHomogenization - print*, 'Homogenization parsed' + call material_parseHomogenization + num_homog => config_numerics%get('homogenization',defaultVal=emptyDict) num_homogGeneric => num_homog%get('generic',defaultVal=emptyDict) diff --git a/src/phase_damage.f90 b/src/phase_damage.f90 index 803a9251d..ca08d8aea 100644 --- a/src/phase_damage.f90 +++ b/src/phase_damage.f90 @@ -15,31 +15,27 @@ submodule(phase) damagee real(pReal), dimension(:), allocatable :: phi, d_phi_d_dot_phi end type tDataContainer - integer(kind(DAMAGE_UNDEFINED_ID)), dimension(:,:), allocatable :: & + integer(kind(DAMAGE_UNDEFINED_ID)), dimension(:), allocatable :: & phase_source !< active sources mechanisms of each phase type(tDataContainer), dimension(:), allocatable :: current interface - module function anisobrittle_init(source_length) result(mySources) - integer, intent(in) :: source_length - logical, dimension(:,:), allocatable :: mySources + module function anisobrittle_init() result(mySources) + logical, dimension(:), allocatable :: mySources end function anisobrittle_init - module function anisoductile_init(source_length) result(mySources) - integer, intent(in) :: source_length - logical, dimension(:,:), allocatable :: mySources + module function anisoductile_init() result(mySources) + logical, dimension(:), allocatable :: mySources end function anisoductile_init - module function isobrittle_init(source_length) result(mySources) - integer, intent(in) :: source_length - logical, dimension(:,:), allocatable :: mySources + module function isobrittle_init() result(mySources) + logical, dimension(:), allocatable :: mySources end function isobrittle_init - module function isoductile_init(source_length) result(mySources) - integer, intent(in) :: source_length - logical, dimension(:,:), allocatable :: mySources + module function isoductile_init() result(mySources) + logical, dimension(:), allocatable :: mySources end function isoductile_init @@ -163,14 +159,14 @@ module subroutine damage_init enddo - allocate(phase_source(maxval(phase_Nsources),phases%length), source = DAMAGE_UNDEFINED_ID) + allocate(phase_source(phases%length), source = DAMAGE_UNDEFINED_ID) ! initialize source mechanisms if(maxval(phase_Nsources) /= 0) then - where(isobrittle_init (maxval(phase_Nsources))) phase_source = DAMAGE_ISOBRITTLE_ID - where(isoductile_init (maxval(phase_Nsources))) phase_source = DAMAGE_ISODUCTILE_ID - where(anisobrittle_init (maxval(phase_Nsources))) phase_source = DAMAGE_ANISOBRITTLE_ID - where(anisoductile_init (maxval(phase_Nsources))) phase_source = DAMAGE_ANISODUCTILE_ID + where(isobrittle_init() ) phase_source = DAMAGE_ISOBRITTLE_ID + where(isoductile_init() ) phase_source = DAMAGE_ISODUCTILE_ID + where(anisobrittle_init()) phase_source = DAMAGE_ANISOBRITTLE_ID + where(anisoductile_init()) phase_source = DAMAGE_ANISODUCTILE_ID endif end subroutine damage_init @@ -206,7 +202,7 @@ module subroutine phase_damage_getRateAndItsTangents(phiDot, dPhiDot_dPhi, phi, ph = material_phaseAt(co,el) me = material_phasememberAt(co,ip,el) do so = 1, phase_Nsources(ph) - select case(phase_source(so,ph)) + select case(phase_source(ph)) case (DAMAGE_ISOBRITTLE_ID) call isobrittle_getRateAndItsTangent (localphiDot, dLocalphiDot_dPhi, phi, ph, me) @@ -340,10 +336,10 @@ module subroutine damage_results(group,ph) sourceLoop: do so = 1, phase_Nsources(ph) - if (phase_source(so,ph) /= DAMAGE_UNDEFINED_ID) & + if (phase_source(ph) /= DAMAGE_UNDEFINED_ID) & call results_closeGroup(results_addGroup(group//'sources/')) ! should be 'damage' - sourceType: select case (phase_source(so,ph)) + sourceType: select case (phase_source(ph)) case (DAMAGE_ISOBRITTLE_ID) sourceType call isobrittle_results(ph,group//'sources/') @@ -379,7 +375,7 @@ function phase_damage_collectDotState(ph,me) result(broken) if (phase_Nsources(ph)==1) then - sourceType: select case (phase_source(1,ph)) + sourceType: select case (phase_source(ph)) case (DAMAGE_ISODUCTILE_ID) sourceType call isoductile_dotState(ph,me) @@ -422,7 +418,7 @@ function phase_damage_deltaState(Fe, ph, me) result(broken) if (phase_Nsources(ph) == 0) return - sourceType: select case (phase_source(1,ph)) + sourceType: select case (phase_source(ph)) case (DAMAGE_ISOBRITTLE_ID) sourceType call isobrittle_deltaState(phase_homogenizedC(ph,me), Fe, ph,me) @@ -443,28 +439,25 @@ end function phase_damage_deltaState !-------------------------------------------------------------------------------------------------- !> @brief checks if a source mechanism is active or not !-------------------------------------------------------------------------------------------------- -function source_active(source_label,src_length) result(active_source) +function source_active(source_label) 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 + logical, dimension(:), allocatable :: active_source class(tNode), pointer :: & phases, & phase, & sources, & src - integer :: p,s + integer :: ph phases => config_material%get('phase') - allocate(active_source(src_length,phases%length), source = .false. ) - do p = 1, phases%length - phase => phases%get(p) + allocate(active_source(phases%length)) + do ph = 1, phases%length + phase => phases%get(ph) sources => phase%get('damage',defaultVal=emptyList) - do s = 1, sources%length - src => sources%get(s) - if(src%get_asString('type') == source_label) active_source(s,p) = .true. - enddo + src => sources%get(1) + active_source(ph) = src%get_asString('type') == source_label enddo diff --git a/src/phase_damage_anisobrittle.f90 b/src/phase_damage_anisobrittle.f90 index a121ee932..07dd42945 100644 --- a/src/phase_damage_anisobrittle.f90 +++ b/src/phase_damage_anisobrittle.f90 @@ -31,23 +31,22 @@ contains !> @brief module initialization !> @details reads in material parameters, allocates arrays, and does sanity checks !-------------------------------------------------------------------------------------------------- -module function anisobrittle_init(source_length) result(mySources) +module function anisobrittle_init() result(mySources) - integer, intent(in) :: source_length - logical, dimension(:,:), allocatable :: mySources + logical, dimension(:), allocatable :: mySources class(tNode), pointer :: & phases, & phase, & sources, & src - integer :: Ninstances,sourceOffset,Nconstituents,p + integer :: Ninstances,Nconstituents,p integer, dimension(:), allocatable :: N_cl character(len=pStringLen) :: extmsg = '' print'(/,a)', ' <<<+- phase:damage:anisobrittle init -+>>>' - mySources = source_active('anisobrittle',source_length) + mySources = source_active('anisobrittle') Ninstances = count(mySources) print'(a,i2)', ' # instances: ',Ninstances; flush(IO_STDOUT) if(Ninstances == 0) return @@ -57,13 +56,12 @@ module function anisobrittle_init(source_length) result(mySources) do p = 1, phases%length + if(mySources(p)) then phase => phases%get(p) - if(count(mySources(:,p)) == 0) cycle sources => phase%get('damage') - do sourceOffset = 1, sources%length - if(mySources(sourceOffset,p)) then + associate(prm => param(p)) - src => sources%get(sourceOffset) + src => sources%get(1) N_cl = src%get_asInts('N_cl',defaultVal=emptyIntArray) prm%sum_N_cl = sum(abs(N_cl)) @@ -104,7 +102,7 @@ module function anisobrittle_init(source_length) result(mySources) ! exit if any parameter is out of range if (extmsg /= '') call IO_error(211,ext_msg=trim(extmsg)//'(damage_anisoBrittle)') endif - enddo + enddo end function anisobrittle_init diff --git a/src/phase_damage_anisoductile.f90 b/src/phase_damage_anisoductile.f90 index cf55e398b..aad361238 100644 --- a/src/phase_damage_anisoductile.f90 +++ b/src/phase_damage_anisoductile.f90 @@ -24,10 +24,9 @@ contains !> @brief module initialization !> @details reads in material parameters, allocates arrays, and does sanity checks !-------------------------------------------------------------------------------------------------- -module function anisoductile_init(source_length) result(mySources) +module function anisoductile_init() result(mySources) - integer, intent(in) :: source_length - logical, dimension(:,:), allocatable :: mySources + logical, dimension(:), allocatable :: mySources class(tNode), pointer :: & phases, & @@ -36,13 +35,13 @@ module function anisoductile_init(source_length) result(mySources) pl, & sources, & src - integer :: Ninstances,sourceOffset,Nconstituents,p + integer :: Ninstances,Nconstituents,p integer, dimension(:), allocatable :: N_sl character(len=pStringLen) :: extmsg = '' print'(/,a)', ' <<<+- phase:damage:anisoductile init -+>>>' - mySources = source_active('damage_anisoDuctile',source_length) + mySources = source_active('damage_anisoDuctile') Ninstances = count(mySources) print'(a,i2)', ' # instances: ',Ninstances; flush(IO_STDOUT) if(Ninstances == 0) return @@ -51,15 +50,15 @@ module function anisoductile_init(source_length) result(mySources) allocate(param(phases%length)) do p = 1, phases%length - phase => phases%get(p) - if(count(mySources(:,p)) == 0) cycle - mech => phase%get('mechanics') - pl => mech%get('plasticity') - sources => phase%get('source') - do sourceOffset = 1, sources%length - if(mySources(sourceOffset,p)) then + if(mySources(p)) then + phase => phases%get(p) + mech => phase%get('mechanics') + pl => mech%get('plasticity') + sources => phase%get('damage') + + associate(prm => param(p)) - src => sources%get(sourceOffset) + src => sources%get(1) N_sl = pl%get_asInts('N_sl',defaultVal=emptyIntArray) prm%q = src%get_asFloat('q') @@ -78,7 +77,7 @@ module function anisoductile_init(source_length) result(mySources) if (prm%q <= 0.0_pReal) extmsg = trim(extmsg)//' q' if (any(prm%gamma_crit < 0.0_pReal)) extmsg = trim(extmsg)//' gamma_crit' - Nconstituents=count(material_phaseAt==p) * discretization_nIPs + Nconstituents=count(material_phaseAt2==p) call phase_allocateState(damageState(p),Nconstituents,1,1,0) damageState(p)%atol = src%get_asFloat('anisoDuctile_atol',defaultVal=1.0e-3_pReal) if(any(damageState(p)%atol < 0.0_pReal)) extmsg = trim(extmsg)//' anisoductile_atol' @@ -89,7 +88,7 @@ module function anisoductile_init(source_length) result(mySources) ! exit if any parameter is out of range if (extmsg /= '') call IO_error(211,ext_msg=trim(extmsg)//'(damage_anisoDuctile)') endif - enddo + enddo diff --git a/src/phase_damage_isobrittle.f90 b/src/phase_damage_isobrittle.f90 index e267ffcc9..973817ec6 100644 --- a/src/phase_damage_isobrittle.f90 +++ b/src/phase_damage_isobrittle.f90 @@ -22,22 +22,21 @@ contains !> @brief module initialization !> @details reads in material parameters, allocates arrays, and does sanity checks !-------------------------------------------------------------------------------------------------- -module function isobrittle_init(source_length) result(mySources) +module function isobrittle_init() result(mySources) - integer, intent(in) :: source_length - logical, dimension(:,:), allocatable :: mySources + logical, dimension(:), allocatable :: mySources class(tNode), pointer :: & phases, & phase, & sources, & src - integer :: Ninstances,sourceOffset,Nconstituents,p + integer :: Ninstances,Nconstituents,p character(len=pStringLen) :: extmsg = '' print'(/,a)', ' <<<+- phase:damage:isobrittle init -+>>>' - mySources = source_active('isobrittle',source_length) + mySources = source_active('isobrittle') Ninstances = count(mySources) print'(a,i2)', ' # instances: ',Ninstances; flush(IO_STDOUT) if(Ninstances == 0) return @@ -46,13 +45,12 @@ module function isobrittle_init(source_length) result(mySources) allocate(param(phases%length)) do p = 1, phases%length + if(mySources(p)) then phase => phases%get(p) - if(count(mySources(:,p)) == 0) cycle sources => phase%get('damage') - do sourceOffset = 1, sources%length - if(mySources(sourceOffset,p)) then + associate(prm => param(p)) - src => sources%get(sourceOffset) + src => sources%get(1) prm%W_crit = src%get_asFloat('W_crit') @@ -65,7 +63,7 @@ module function isobrittle_init(source_length) result(mySources) ! sanity checks if (prm%W_crit <= 0.0_pReal) extmsg = trim(extmsg)//' W_crit' - Nconstituents = count(material_phaseAt==p) * discretization_nIPs + Nconstituents = count(material_phaseAt2==p) call phase_allocateState(damageState(p),Nconstituents,1,1,1) damageState(p)%atol = src%get_asFloat('isoBrittle_atol',defaultVal=1.0e-3_pReal) if(any(damageState(p)%atol < 0.0_pReal)) extmsg = trim(extmsg)//' isobrittle_atol' @@ -76,7 +74,7 @@ module function isobrittle_init(source_length) result(mySources) ! exit if any parameter is out of range if (extmsg /= '') call IO_error(211,ext_msg=trim(extmsg)//'(damage_isoBrittle)') endif - enddo + enddo diff --git a/src/phase_damage_isoductile.f90 b/src/phase_damage_isoductile.f90 index f59952222..abcef1236 100644 --- a/src/phase_damage_isoductile.f90 +++ b/src/phase_damage_isoductile.f90 @@ -24,22 +24,21 @@ contains !> @brief module initialization !> @details reads in material parameters, allocates arrays, and does sanity checks !-------------------------------------------------------------------------------------------------- -module function isoductile_init(source_length) result(mySources) +module function isoductile_init() result(mySources) - integer, intent(in) :: source_length - logical, dimension(:,:), allocatable :: mySources + logical, dimension(:), allocatable :: mySources class(tNode), pointer :: & phases, & phase, & sources, & src - integer :: Ninstances,sourceOffset,Nconstituents,p + integer :: Ninstances,Nconstituents,p character(len=pStringLen) :: extmsg = '' print'(/,a)', ' <<<+- phase:damage:isoductile init -+>>>' - mySources = source_active('isoductile',source_length) + mySources = source_active('isoductile') Ninstances = count(mySources) print'(a,i2)', ' # instances: ',Ninstances; flush(IO_STDOUT) if(Ninstances == 0) return @@ -48,13 +47,12 @@ module function isoductile_init(source_length) result(mySources) allocate(param(phases%length)) do p = 1, phases%length - phase => phases%get(p) - if(count(mySources(:,p)) == 0) cycle - sources => phase%get('damage') - do sourceOffset = 1, sources%length - if(mySources(sourceOffset,p)) then + if(mySources(p)) then + phase => phases%get(p) + sources => phase%get('damage') + associate(prm => param(p)) - src => sources%get(sourceOffset) + src => sources%get(1) prm%q = src%get_asFloat('q') prm%gamma_crit = src%get_asFloat('gamma_crit') @@ -69,7 +67,7 @@ module function isoductile_init(source_length) result(mySources) if (prm%q <= 0.0_pReal) extmsg = trim(extmsg)//' q' if (prm%gamma_crit <= 0.0_pReal) extmsg = trim(extmsg)//' gamma_crit' - Nconstituents=count(material_phaseAt==p) * discretization_nIPs + Nconstituents=count(material_phaseAt2==p) call phase_allocateState(damageState(p),Nconstituents,1,1,0) damageState(p)%atol = src%get_asFloat('isoDuctile_atol',defaultVal=1.0e-3_pReal) if(any(damageState(p)%atol < 0.0_pReal)) extmsg = trim(extmsg)//' isoductile_atol' @@ -80,7 +78,6 @@ module function isoductile_init(source_length) result(mySources) ! exit if any parameter is out of range if (extmsg /= '') call IO_error(211,ext_msg=trim(extmsg)//'(damage_isoDuctile)') endif - enddo enddo From ab202b8e7314ca2a1049a2e4195744d9eae8de98 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sat, 13 Feb 2021 13:07:35 +0100 Subject: [PATCH 38/60] less verbose reporting --- src/phase_damage_anisobrittle.f90 | 11 +++++---- src/phase_damage_anisoductile.f90 | 11 +++++---- src/phase_damage_isobrittle.f90 | 11 +++++---- src/phase_damage_isoductile.f90 | 9 +++---- ...phase_mechanical_plastic_dislotungsten.f90 | 7 +++--- src/phase_mechanical_plastic_dislotwin.f90 | 6 ++--- src/phase_mechanical_plastic_isotropic.f90 | 7 +++--- ...phase_mechanical_plastic_kinehardening.f90 | 7 +++--- src/phase_mechanical_plastic_none.f90 | 24 +++++-------------- src/phase_mechanical_plastic_nonlocal.f90 | 6 ++--- ...phase_mechanical_plastic_phenopowerlaw.f90 | 6 +++-- 11 files changed, 51 insertions(+), 54 deletions(-) diff --git a/src/phase_damage_anisobrittle.f90 b/src/phase_damage_anisobrittle.f90 index 07dd42945..bfd069031 100644 --- a/src/phase_damage_anisobrittle.f90 +++ b/src/phase_damage_anisobrittle.f90 @@ -40,16 +40,17 @@ module function anisobrittle_init() result(mySources) phase, & sources, & src - integer :: Ninstances,Nconstituents,p + integer :: Nconstituents,p integer, dimension(:), allocatable :: N_cl character(len=pStringLen) :: extmsg = '' - print'(/,a)', ' <<<+- phase:damage:anisobrittle init -+>>>' mySources = source_active('anisobrittle') - Ninstances = count(mySources) - print'(a,i2)', ' # instances: ',Ninstances; flush(IO_STDOUT) - if(Ninstances == 0) return + if(count(mySources) == 0) return + + print'(/,a)', ' <<<+- phase:damage:anisobrittle init -+>>>' + print'(a,i0)', ' # phases: ',count(mySources); flush(IO_STDOUT) + phases => config_material%get('phase') allocate(param(phases%length)) diff --git a/src/phase_damage_anisoductile.f90 b/src/phase_damage_anisoductile.f90 index aad361238..f50c05f07 100644 --- a/src/phase_damage_anisoductile.f90 +++ b/src/phase_damage_anisoductile.f90 @@ -39,12 +39,13 @@ module function anisoductile_init() result(mySources) integer, dimension(:), allocatable :: N_sl character(len=pStringLen) :: extmsg = '' - print'(/,a)', ' <<<+- phase:damage:anisoductile init -+>>>' - mySources = source_active('damage_anisoDuctile') - Ninstances = count(mySources) - print'(a,i2)', ' # instances: ',Ninstances; flush(IO_STDOUT) - if(Ninstances == 0) return + mySources = source_active('anisoductile') + if(count(mySources) == 0) return + + print'(/,a)', ' <<<+- phase:damage:anisoductile init -+>>>' + print'(a,i0)', ' # phases: ',count(mySources); flush(IO_STDOUT) + phases => config_material%get('phase') allocate(param(phases%length)) diff --git a/src/phase_damage_isobrittle.f90 b/src/phase_damage_isobrittle.f90 index 973817ec6..1cc0d7900 100644 --- a/src/phase_damage_isobrittle.f90 +++ b/src/phase_damage_isobrittle.f90 @@ -31,15 +31,16 @@ module function isobrittle_init() result(mySources) phase, & sources, & src - integer :: Ninstances,Nconstituents,p + integer :: Nconstituents,p character(len=pStringLen) :: extmsg = '' - print'(/,a)', ' <<<+- phase:damage:isobrittle init -+>>>' mySources = source_active('isobrittle') - Ninstances = count(mySources) - print'(a,i2)', ' # instances: ',Ninstances; flush(IO_STDOUT) - if(Ninstances == 0) return + if(count(mySources) == 0) return + + print'(/,a)', ' <<<+- phase:damage:isobrittle init -+>>>' + print'(a,i0)', ' # phases: ',count(mySources); flush(IO_STDOUT) + phases => config_material%get('phase') allocate(param(phases%length)) diff --git a/src/phase_damage_isoductile.f90 b/src/phase_damage_isoductile.f90 index abcef1236..247cd715a 100644 --- a/src/phase_damage_isoductile.f90 +++ b/src/phase_damage_isoductile.f90 @@ -36,12 +36,13 @@ module function isoductile_init() result(mySources) integer :: Ninstances,Nconstituents,p character(len=pStringLen) :: extmsg = '' - print'(/,a)', ' <<<+- phase:damage:isoductile init -+>>>' mySources = source_active('isoductile') - Ninstances = count(mySources) - print'(a,i2)', ' # instances: ',Ninstances; flush(IO_STDOUT) - if(Ninstances == 0) return + if(count(mySources) == 0) return + + print'(/,a)', ' <<<+- phase:damage:isoductile init -+>>>' + print'(a,i0)', ' # phases: ',count(mySources); flush(IO_STDOUT) + phases => config_material%get('phase') allocate(param(phases%length)) diff --git a/src/phase_mechanical_plastic_dislotungsten.f90 b/src/phase_mechanical_plastic_dislotungsten.f90 index a9946b6e7..4db546b67 100644 --- a/src/phase_mechanical_plastic_dislotungsten.f90 +++ b/src/phase_mechanical_plastic_dislotungsten.f90 @@ -97,13 +97,14 @@ module function plastic_dislotungsten_init() result(myPlasticity) mech, & pl - print'(/,a)', ' <<<+- phase:mechanics:plastic:dislotungsten init -+>>>' - myPlasticity = plastic_active('dislotungsten') Ninstances = count(myPlasticity) - print'(a,i2)', ' # instances: ',Ninstances; flush(IO_STDOUT) if(Ninstances == 0) return + print'(/,a)', ' <<<+- phase:mechanics:plastic:dislotungsten init -+>>>' + print'(a,i0)', ' # phases: ',Ninstances; flush(IO_STDOUT) + + print*, 'Cereceda et al., International Journal of Plasticity 78:242–256, 2016' print*, 'https://dx.doi.org/10.1016/j.ijplas.2015.09.002' diff --git a/src/phase_mechanical_plastic_dislotwin.f90 b/src/phase_mechanical_plastic_dislotwin.f90 index e1259fbd2..2a011dfda 100644 --- a/src/phase_mechanical_plastic_dislotwin.f90 +++ b/src/phase_mechanical_plastic_dislotwin.f90 @@ -144,13 +144,13 @@ module function plastic_dislotwin_init() result(myPlasticity) mech, & pl - print'(/,a)', ' <<<+- phase:mechanics:plastic:dislotwin init -+>>>' - myPlasticity = plastic_active('dislotwin') Ninstances = count(myPlasticity) - print'(a,i2)', ' # instances: ',Ninstances; flush(IO_STDOUT) if(Ninstances == 0) return + print'(/,a)', ' <<<+- phase:mechanics:plastic:dislotwin init -+>>>' + print'(a,i0)', ' # phases: ',Ninstances; flush(IO_STDOUT) + print*, 'Ma and Roters, Acta Materialia 52(12):3603–3612, 2004' print*, 'https://doi.org/10.1016/j.actamat.2004.04.012'//IO_EOL diff --git a/src/phase_mechanical_plastic_isotropic.f90 b/src/phase_mechanical_plastic_isotropic.f90 index 1a4e1449a..4cb1bf28c 100644 --- a/src/phase_mechanical_plastic_isotropic.f90 +++ b/src/phase_mechanical_plastic_isotropic.f90 @@ -68,13 +68,14 @@ module function plastic_isotropic_init() result(myPlasticity) mech, & pl - print'(/,a)', ' <<<+- phase:mechanics:plastic:isotropic init -+>>>' - myPlasticity = plastic_active('isotropic') Ninstances = count(myPlasticity) - print'(a,i2)', ' # instances: ',Ninstances; flush(IO_STDOUT) if(Ninstances == 0) return + print'(/,a)', ' <<<+- phase:mechanics:plastic:isotropic init -+>>>' + print'(a,i0)', ' # phses: ',Ninstances; flush(IO_STDOUT) + + print*, 'Maiti and Eisenlohr, Scripta Materialia 145:37–40, 2018' print*, 'https://doi.org/10.1016/j.scriptamat.2017.09.047' diff --git a/src/phase_mechanical_plastic_kinehardening.f90 b/src/phase_mechanical_plastic_kinehardening.f90 index f00e4171b..0ef762ffe 100644 --- a/src/phase_mechanical_plastic_kinehardening.f90 +++ b/src/phase_mechanical_plastic_kinehardening.f90 @@ -80,13 +80,14 @@ module function plastic_kinehardening_init() result(myPlasticity) mech, & pl - print'(/,a)', ' <<<+- phase:mechanics:plastic:kinehardening init -+>>>' - myPlasticity = plastic_active('kinehardening') Ninstances = count(myPlasticity) - print'(a,i2)', ' # instances: ',Ninstances; flush(IO_STDOUT) if(Ninstances == 0) return + print'(/,a)', ' <<<+- phase:mechanics:plastic:kinehardening init -+>>>' + print'(a,i0)', ' # phases: ',Ninstances; flush(IO_STDOUT) + + allocate(param(Ninstances)) allocate(state(Ninstances)) allocate(dotState(Ninstances)) diff --git a/src/phase_mechanical_plastic_none.f90 b/src/phase_mechanical_plastic_none.f90 index b95eaa039..053fe6507 100644 --- a/src/phase_mechanical_plastic_none.f90 +++ b/src/phase_mechanical_plastic_none.f90 @@ -16,32 +16,20 @@ module function plastic_none_init() result(myPlasticity) logical, dimension(:), allocatable :: myPlasticity integer :: & - Ninstances, & p, & Nconstituents class(tNode), pointer :: & - phases, & - phase, & - mech, & - pl + phases + + + myPlasticity = plastic_active('nonlocal') + if(count(myPlasticity) == 0) return print'(/,a)', ' <<<+- phase:mechanics:plastic:none init -+>>>' + print'(a,i0)', ' # phases: ',count(myPlasticity); flush(IO_STDOUT) phases => config_material%get('phase') - allocate(myPlasticity(phases%length), source = .false.) do p = 1, phases%length - phase => phases%get(p) - mech => phase%get('mechanics') - pl => mech%get ('plasticity') - if(pl%get_asString('type') == 'none') myPlasticity(p) = .true. - enddo - - Ninstances = count(myPlasticity) - print'(a,i2)', ' # instances: ',Ninstances; flush(IO_STDOUT) - if(Ninstances == 0) return - - do p = 1, phases%length - phase => phases%get(p) if(.not. myPlasticity(p)) cycle Nconstituents = count(material_phaseAt2 == p) call phase_allocateState(plasticState(p),Nconstituents,0,0,0) diff --git a/src/phase_mechanical_plastic_nonlocal.f90 b/src/phase_mechanical_plastic_nonlocal.f90 index 724086916..5cfd9cf4d 100644 --- a/src/phase_mechanical_plastic_nonlocal.f90 +++ b/src/phase_mechanical_plastic_nonlocal.f90 @@ -187,16 +187,16 @@ module function plastic_nonlocal_init() result(myPlasticity) mech, & pl - print'(/,a)', ' <<<+- phase:mechanics:plastic:nonlocal init -+>>>' - myPlasticity = plastic_active('nonlocal') Ninstances = count(myPlasticity) - print'(a,i2)', ' # instances: ',Ninstances; flush(IO_STDOUT) if(Ninstances == 0) then call geometry_plastic_nonlocal_disable return endif + print'(/,a)', ' <<<+- phase:mechanics:plastic:nonlocal init -+>>>' + print'(a,i0)', ' # phases: ',Ninstances; flush(IO_STDOUT) + print*, 'Reuber et al., Acta Materialia 71:333–348, 2014' print*, 'https://doi.org/10.1016/j.actamat.2014.03.012'//IO_EOL diff --git a/src/phase_mechanical_plastic_phenopowerlaw.f90 b/src/phase_mechanical_plastic_phenopowerlaw.f90 index f9791faa6..6a7d5ea7f 100644 --- a/src/phase_mechanical_plastic_phenopowerlaw.f90 +++ b/src/phase_mechanical_plastic_phenopowerlaw.f90 @@ -89,13 +89,15 @@ module function plastic_phenopowerlaw_init() result(myPlasticity) mech, & pl - print'(/,a)', ' <<<+- phase:mechanics:plastic:phenopowerlaw init -+>>>' myPlasticity = plastic_active('phenopowerlaw') Ninstances = count(myPlasticity) - print'(a,i2)', ' # instances: ',Ninstances; flush(IO_STDOUT) if(Ninstances == 0) return + print'(/,a)', ' <<<+- phase:mechanics:plastic:phenopowerlaw init -+>>>' + print'(a,i0)', ' # phases: ',Ninstances; flush(IO_STDOUT) + + allocate(param(Ninstances)) allocate(state(Ninstances)) allocate(dotState(Ninstances)) From 9ba185973fe539d530ab40276dc6624117661002 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sat, 13 Feb 2021 13:33:58 +0100 Subject: [PATCH 39/60] more systematic directory structure --- PRIVATE | 2 +- examples/{SpectralMethod/Polycrystal => grid}/20grains.seeds | 0 .../{SpectralMethod/Polycrystal => grid}/20grains16x16x16.vtr | 0 .../{SpectralMethod/Polycrystal => grid}/20grains32x32x32.vtr | 0 .../{SpectralMethod/Polycrystal => grid}/20grains64x64x64.vtr | 0 examples/{SpectralMethod/Polycrystal => grid}/material.yaml | 0 examples/{SpectralMethod/Polycrystal => grid}/numerics.yaml | 0 examples/{SpectralMethod/Polycrystal => grid}/shearXY.yaml | 0 examples/{SpectralMethod/Polycrystal => grid}/shearZX.yaml | 0 examples/{SpectralMethod/Polycrystal => grid}/tensionX.yaml | 0 10 files changed, 1 insertion(+), 1 deletion(-) rename examples/{SpectralMethod/Polycrystal => grid}/20grains.seeds (100%) rename examples/{SpectralMethod/Polycrystal => grid}/20grains16x16x16.vtr (100%) rename examples/{SpectralMethod/Polycrystal => grid}/20grains32x32x32.vtr (100%) rename examples/{SpectralMethod/Polycrystal => grid}/20grains64x64x64.vtr (100%) rename examples/{SpectralMethod/Polycrystal => grid}/material.yaml (100%) rename examples/{SpectralMethod/Polycrystal => grid}/numerics.yaml (100%) rename examples/{SpectralMethod/Polycrystal => grid}/shearXY.yaml (100%) rename examples/{SpectralMethod/Polycrystal => grid}/shearZX.yaml (100%) rename examples/{SpectralMethod/Polycrystal => grid}/tensionX.yaml (100%) diff --git a/PRIVATE b/PRIVATE index 571b06ac4..d7f8460aa 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit 571b06ac4b42ed217eacfa5c71281e571bdab1df +Subproject commit d7f8460aa2afceb89f9b82054555d5dc6f9e5c43 diff --git a/examples/SpectralMethod/Polycrystal/20grains.seeds b/examples/grid/20grains.seeds similarity index 100% rename from examples/SpectralMethod/Polycrystal/20grains.seeds rename to examples/grid/20grains.seeds diff --git a/examples/SpectralMethod/Polycrystal/20grains16x16x16.vtr b/examples/grid/20grains16x16x16.vtr similarity index 100% rename from examples/SpectralMethod/Polycrystal/20grains16x16x16.vtr rename to examples/grid/20grains16x16x16.vtr diff --git a/examples/SpectralMethod/Polycrystal/20grains32x32x32.vtr b/examples/grid/20grains32x32x32.vtr similarity index 100% rename from examples/SpectralMethod/Polycrystal/20grains32x32x32.vtr rename to examples/grid/20grains32x32x32.vtr diff --git a/examples/SpectralMethod/Polycrystal/20grains64x64x64.vtr b/examples/grid/20grains64x64x64.vtr similarity index 100% rename from examples/SpectralMethod/Polycrystal/20grains64x64x64.vtr rename to examples/grid/20grains64x64x64.vtr diff --git a/examples/SpectralMethod/Polycrystal/material.yaml b/examples/grid/material.yaml similarity index 100% rename from examples/SpectralMethod/Polycrystal/material.yaml rename to examples/grid/material.yaml diff --git a/examples/SpectralMethod/Polycrystal/numerics.yaml b/examples/grid/numerics.yaml similarity index 100% rename from examples/SpectralMethod/Polycrystal/numerics.yaml rename to examples/grid/numerics.yaml diff --git a/examples/SpectralMethod/Polycrystal/shearXY.yaml b/examples/grid/shearXY.yaml similarity index 100% rename from examples/SpectralMethod/Polycrystal/shearXY.yaml rename to examples/grid/shearXY.yaml diff --git a/examples/SpectralMethod/Polycrystal/shearZX.yaml b/examples/grid/shearZX.yaml similarity index 100% rename from examples/SpectralMethod/Polycrystal/shearZX.yaml rename to examples/grid/shearZX.yaml diff --git a/examples/SpectralMethod/Polycrystal/tensionX.yaml b/examples/grid/tensionX.yaml similarity index 100% rename from examples/SpectralMethod/Polycrystal/tensionX.yaml rename to examples/grid/tensionX.yaml From b3231bf0a82989e3c90e422feba9fb389766b771 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sat, 13 Feb 2021 14:15:41 +0100 Subject: [PATCH 40/60] avoid undefined return --- src/phase_damage.f90 | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/phase_damage.f90 b/src/phase_damage.f90 index ca08d8aea..2eda9540d 100644 --- a/src/phase_damage.f90 +++ b/src/phase_damage.f90 @@ -256,16 +256,20 @@ module function integrateDamageState(dt,co,ip,el) result(broken) converged_ ph = material_phaseAt(co,el) - if (phase_Nsources(ph) == 0) return me = material_phaseMemberAt(co,ip,el) + if (phase_Nsources(ph) == 0) then + broken = .false. + return + endif + converged_ = .true. broken = phase_damage_collectDotState(ph,me) if(broken) return size_so = damageState(ph)%sizeDotState damageState(ph)%state(1:size_so,me) = damageState(ph)%subState0(1:size_so,me) & - + damageState(ph)%dotState (1:size_so,me) * dt + + damageState(ph)%dotState (1:size_so,me) * dt source_dotState(1:size_so,2) = 0.0_pReal iteration: do NiterationState = 1, num%nState From 595ee7a35a3d4519d30b28e8a030a10764453362 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sat, 13 Feb 2021 14:38:53 +0100 Subject: [PATCH 41/60] copy and paste error --- src/phase_mechanical_plastic_none.f90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/phase_mechanical_plastic_none.f90 b/src/phase_mechanical_plastic_none.f90 index 053fe6507..f16cf98fb 100644 --- a/src/phase_mechanical_plastic_none.f90 +++ b/src/phase_mechanical_plastic_none.f90 @@ -22,7 +22,7 @@ module function plastic_none_init() result(myPlasticity) phases - myPlasticity = plastic_active('nonlocal') + myPlasticity = plastic_active('none') if(count(myPlasticity) == 0) return print'(/,a)', ' <<<+- phase:mechanics:plastic:none init -+>>>' From 72c099dbbe9f6990d21458889bea5e355105dec9 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sat, 13 Feb 2021 14:17:08 +0100 Subject: [PATCH 42/60] store data separetly --- PRIVATE | 2 +- src/lattice.f90 | 17 +++++++++++------ src/phase_mechanical_eigen.f90 | 15 +++++++-------- 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/PRIVATE b/PRIVATE index d7f8460aa..42ebe55f0 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit d7f8460aa2afceb89f9b82054555d5dc6f9e5c43 +Subproject commit 42ebe55f0ef1cd799115bd87e45d6025db42f7a7 diff --git a/src/lattice.f90 b/src/lattice.f90 index c9b6d99ef..e5f5453d4 100644 --- a/src/lattice.f90 +++ b/src/lattice.f90 @@ -459,7 +459,8 @@ subroutine lattice_init phase, & mech, & elasticity, & - thermal + thermal, & + damage print'(/,a)', ' <<<+- lattice init -+>>>'; flush(IO_STDOUT) @@ -535,13 +536,17 @@ subroutine lattice_init endif - lattice_D(1,1,ph) = phase%get_asFloat('D_11',defaultVal=0.0_pReal) - lattice_D(2,2,ph) = phase%get_asFloat('D_22',defaultVal=0.0_pReal) - lattice_D(3,3,ph) = phase%get_asFloat('D_33',defaultVal=0.0_pReal) - lattice_D(1:3,1:3,ph) = lattice_applyLatticeSymmetry33(lattice_D(1:3,1:3,ph), & + if (phase%contains('damage')) then + damage => phase%get('damage') + damage => damage%get(1) + lattice_D(1,1,ph) = damage%get_asFloat('D_11',defaultVal=0.0_pReal) + lattice_D(2,2,ph) = damage%get_asFloat('D_22',defaultVal=0.0_pReal) + lattice_D(3,3,ph) = damage%get_asFloat('D_33',defaultVal=0.0_pReal) + lattice_D(1:3,1:3,ph) = lattice_applyLatticeSymmetry33(lattice_D(1:3,1:3,ph), & phase%get_asString('lattice')) - lattice_M(ph) = phase%get_asFloat('M',defaultVal=0.0_pReal) + lattice_M(ph) = damage%get_asFloat('M',defaultVal=0.0_pReal) + endif ! SHOULD NOT BE PART OF LATTICE END call selfTest diff --git a/src/phase_mechanical_eigen.f90 b/src/phase_mechanical_eigen.f90 index 9eb3c5767..439f2bef9 100644 --- a/src/phase_mechanical_eigen.f90 +++ b/src/phase_mechanical_eigen.f90 @@ -74,8 +74,8 @@ module subroutine eigendeformation_init(phases) kinematics => phase%get('damage',defaultVal=emptyList) if(kinematics%length >0) then damage => kinematics%get(1) - if(damage%get_asString('type') == 'anisobrittle') phase_Nkinematics(ph) = phase_Nkinematics(ph) +1 - if(damage%get_asString('type') == 'isoductile') phase_Nkinematics(ph) = phase_Nkinematics(ph) +1 + if(damage%get_asString('type',defaultVal='n/a') == 'anisobrittle') phase_Nkinematics(ph) = phase_Nkinematics(ph) +1 + if(damage%get_asString('type',defaultVal='n/a') == 'isoductile' ) phase_Nkinematics(ph) = phase_Nkinematics(ph) +1 endif enddo @@ -113,7 +113,7 @@ function kinematics_active(kinematics_label,kinematics_length) result(active_ki 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. + active_kinematics(k,p) = kinematics_type%get_asString('type') == kinematics_label enddo enddo @@ -136,17 +136,16 @@ function kinematics_active2(kinematics_label,kinematics_length) result(active_k phase, & kinematics, & kinematics_type - integer :: p,k + integer :: p phases => config_material%get('phase') allocate(active_kinematics(kinematics_length,phases%length), source = .false. ) do p = 1, phases%length phase => phases%get(p) kinematics => phase%get('damage',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 + kinematics_type => kinematics%get(1) + if (.not. kinematics_type%contains('type')) continue + active_kinematics(1,p) = kinematics_type%get_asString('type',defaultVal='n/a') == kinematics_label enddo From 22a0aff488f69b07a757fdb8c1649072be2bbee8 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sat, 13 Feb 2021 18:41:30 +0100 Subject: [PATCH 43/60] separting thermal and damage sources --- src/phase.f90 | 20 ++-- src/phase_damage.f90 | 16 +-- src/phase_mechanical.f90 | 9 +- src/phase_mechanical_eigen.f90 | 102 ++++++++++-------- ...phase_mechanical_eigen_cleavageopening.f90 | 36 +++---- ...hase_mechanical_eigen_slipplaneopening.f90 | 40 ++++--- ...hase_mechanical_eigen_thermalexpansion.f90 | 4 +- src/phase_thermal.f90 | 5 +- src/phase_thermal_dissipation.f90 | 9 +- src/phase_thermal_externalheat.f90 | 11 +- 10 files changed, 129 insertions(+), 123 deletions(-) diff --git a/src/phase.f90 b/src/phase.f90 index 8ea1fa5f7..eb6e61eb8 100644 --- a/src/phase.f90 +++ b/src/phase.f90 @@ -58,12 +58,9 @@ module phase type(tDebugOptions) :: debugCrystallite integer, dimension(:), allocatable, public :: & !< ToDo: should be protected (bug in Intel compiler) - thermal_Nsources, & - phase_Nsources, & !< number of source mechanisms active in each phase - phase_Nkinematics, & !< number of kinematic mechanisms active in each phase + phase_elasticityInstance, & phase_NstiffnessDegradations, & !< number of stiffness degradation mechanisms active in each phase - phase_plasticInstance, & !< instance of particular plasticity of each phase - phase_elasticityInstance !< instance of particular elasticity of each phase + phase_plasticInstance logical, dimension(:), allocatable, public :: & ! ToDo: should be protected (bug in Intel Compiler) phase_localPlasticity !< flags phases with local constitutive law @@ -351,7 +348,7 @@ subroutine phase_init !-------------------------------------------------------------------------------------------------- ! partition and initialize state plasticState(ph)%state = plasticState(ph)%state0 - if(phase_Nsources(ph) > 0) & + if(damageState(ph)%sizeState > 0) & damageState(ph)%state = damageState(ph)%state0 enddo PhaseLoop2 @@ -365,7 +362,7 @@ end subroutine phase_init !> @brief Allocate the components of the state structure for a given phase !-------------------------------------------------------------------------------------------------- subroutine phase_allocateState(state, & - Nconstituents,sizeState,sizeDotState,sizeDeltaState) + Nconstituents,sizeState,sizeDotState,sizeDeltaState) class(tState), intent(out) :: & state @@ -406,7 +403,7 @@ subroutine phase_restore(ce,includeL) do co = 1,homogenization_Nconstituents(material_homogenizationAt2(ce)) - if (phase_Nsources(material_phaseAt2(co,ce)) > 0) & + if (damageState(material_phaseAt2(co,ce))%sizeState > 0) & damageState(material_phaseAt2(co,ce))%state( :,material_phasememberAt2(co,ce)) = & damageState(material_phaseAt2(co,ce))%state0(:,material_phasememberAt2(co,ce)) enddo @@ -429,7 +426,7 @@ subroutine phase_forward() call thermal_forward() do ph = 1, size(damageState) - if (phase_Nsources(ph) > 0) & + if (damageState(ph)%sizeState > 0) & damageState(ph)%state0 = damageState(ph)%state enddo @@ -527,7 +524,7 @@ subroutine crystallite_init() phases => config_material%get('phase') do ph = 1, phases%length - if (phase_Nsources(ph) > 0) & + if (damageState(ph)%sizeState > 0) & allocate(damageState(ph)%subState0,source=damageState(ph)%state0) ! ToDo: hack enddo @@ -574,8 +571,7 @@ subroutine phase_windForward(ip,el) call mechanical_windForward(ph,me) - if (phase_Nsources(ph) > 0) & - damageState(ph)%state0(:,me) = damageState(ph)%state(:,me) + if(damageState(ph)%sizeState > 0) damageState(ph)%state0(:,me) = damageState(ph)%state(:,me) enddo diff --git a/src/phase_damage.f90 b/src/phase_damage.f90 index 2eda9540d..5e4e43017 100644 --- a/src/phase_damage.f90 +++ b/src/phase_damage.f90 @@ -18,6 +18,9 @@ submodule(phase) damagee integer(kind(DAMAGE_UNDEFINED_ID)), dimension(:), allocatable :: & phase_source !< active sources mechanisms of each phase + integer, dimension(:), allocatable :: & + phase_Nsources + type(tDataContainer), dimension(:), allocatable :: current interface @@ -156,6 +159,7 @@ module subroutine damage_init phase => phases%get(ph) sources => phase%get('damage',defaultVal=emptyList) if (sources%length > 1) error stop + phase_Nsources(ph) = sources%length enddo @@ -192,7 +196,6 @@ module subroutine phase_damage_getRateAndItsTangents(phiDot, dPhiDot_dPhi, phi, integer :: & ph, & co, & - so, & me phiDot = 0.0_pReal @@ -201,7 +204,7 @@ module subroutine phase_damage_getRateAndItsTangents(phiDot, dPhiDot_dPhi, phi, do co = 1, homogenization_Nconstituents(material_homogenizationAt(el)) ph = material_phaseAt(co,el) me = material_phasememberAt(co,ip,el) - do so = 1, phase_Nsources(ph) + select case(phase_source(ph)) case (DAMAGE_ISOBRITTLE_ID) call isobrittle_getRateAndItsTangent (localphiDot, dLocalphiDot_dPhi, phi, ph, me) @@ -222,7 +225,6 @@ module subroutine phase_damage_getRateAndItsTangents(phiDot, dPhiDot_dPhi, phi, end select phiDot = phiDot + localphiDot dPhiDot_dPhi = dPhiDot_dPhi + dLocalphiDot_dPhi - enddo enddo end subroutine phase_damage_getRateAndItsTangents @@ -258,7 +260,7 @@ module function integrateDamageState(dt,co,ip,el) result(broken) ph = material_phaseAt(co,el) me = material_phaseMemberAt(co,ip,el) - if (phase_Nsources(ph) == 0) then + if (damageState(ph)%sizeState == 0) then broken = .false. return endif @@ -377,7 +379,7 @@ function phase_damage_collectDotState(ph,me) result(broken) broken = .false. - if (phase_Nsources(ph)==1) then + if (damageState(ph)%sizeState > 0) then sourceType: select case (phase_source(ph)) @@ -420,7 +422,7 @@ function phase_damage_deltaState(Fe, ph, me) result(broken) broken = .false. - if (phase_Nsources(ph) == 0) return + if (damageState(ph)%sizeState == 0) return sourceType: select case (phase_source(ph)) @@ -461,7 +463,7 @@ function source_active(source_label) result(active_source) phase => phases%get(ph) sources => phase%get('damage',defaultVal=emptyList) src => sources%get(1) - active_source(ph) = src%get_asString('type') == source_label + active_source(ph) = src%get_asString('type',defaultVal = 'x') == source_label enddo diff --git a/src/phase_mechanical.f90 b/src/phase_mechanical.f90 index bc4b2cd47..ef962b7e6 100644 --- a/src/phase_mechanical.f90 +++ b/src/phase_mechanical.f90 @@ -3,6 +3,7 @@ !---------------------------------------------------------------------------------------------------- submodule(phase) mechanics + enum, bind(c); enumerator :: & ELASTICITY_UNDEFINED_ID, & ELASTICITY_HOOKE_ID, & @@ -22,8 +23,6 @@ submodule(phase) mechanics KINEMATICS_THERMAL_EXPANSION_ID end enum - integer(kind(KINEMATICS_UNDEFINED_ID)), dimension(:,:), allocatable :: & - phase_kinematics integer(kind(ELASTICITY_UNDEFINED_ID)), dimension(:), allocatable :: & phase_elasticity !< elasticity of each phase integer(kind(STIFFNESS_DEGRADATION_UNDEFINED_ID)), dimension(:,:), allocatable :: & @@ -1159,7 +1158,7 @@ module function crystallite_stress(dt,co,ip,el) result(converged_) subLp0 = phase_mechanical_Lp0(ph)%data(1:3,1:3,me) subState0 = plasticState(ph)%State0(:,me) - if (phase_Nsources(ph) > 0) & + if (damageState(ph)%sizeState > 0) & damageState(ph)%subState0(:,me) = damageState(ph)%state0(:,me) subFp0 = phase_mechanical_Fp0(ph)%data(1:3,1:3,me) @@ -1187,7 +1186,7 @@ module function crystallite_stress(dt,co,ip,el) result(converged_) subFp0 = phase_mechanical_Fp(ph)%data(1:3,1:3,me) subFi0 = phase_mechanical_Fi(ph)%data(1:3,1:3,me) subState0 = plasticState(ph)%state(:,me) - if (phase_Nsources(ph) > 0) & + if (damageState(ph)%sizeState > 0) & damageState(ph)%subState0(:,me) = damageState(ph)%state(:,me) endif @@ -1203,7 +1202,7 @@ module function crystallite_stress(dt,co,ip,el) result(converged_) phase_mechanical_Li(ph)%data(1:3,1:3,me) = subLi0 endif plasticState(ph)%state(:,me) = subState0 - if (phase_Nsources(ph) > 0) & + if (damageState(ph)%sizeState > 0) & damageState(ph)%state(:,me) = damageState(ph)%subState0(:,me) todo = subStep > num%subStepMinCryst ! still on track or already done (beyond repair) diff --git a/src/phase_mechanical_eigen.f90 b/src/phase_mechanical_eigen.f90 index 439f2bef9..d55ff8759 100644 --- a/src/phase_mechanical_eigen.f90 +++ b/src/phase_mechanical_eigen.f90 @@ -1,20 +1,26 @@ submodule(phase:mechanics) eigendeformation + integer, dimension(:), allocatable :: & + Nmodels + + integer(kind(KINEMATICS_UNDEFINED_ID)), dimension(:,:), allocatable :: & + model + integer(kind(KINEMATICS_UNDEFINED_ID)), dimension(:), allocatable :: & + model_damage + interface - module function kinematics_cleavage_opening_init(kinematics_length) result(myKinematics) - integer, intent(in) :: kinematics_length - logical, dimension(:,:), allocatable :: myKinematics + module function kinematics_cleavage_opening_init() result(myKinematics) + logical, dimension(:), allocatable :: myKinematics end function kinematics_cleavage_opening_init - module function kinematics_slipplane_opening_init(kinematics_length) result(myKinematics) - integer, intent(in) :: kinematics_length - logical, dimension(:,:), allocatable :: myKinematics + module function kinematics_slipplane_opening_init() result(myKinematics) + logical, dimension(:), allocatable :: myKinematics end function kinematics_slipplane_opening_init - module function kinematics_thermal_expansion_init(kinematics_length) result(myKinematics) + module function thermalexpansion_init(kinematics_length) result(myKinematics) integer, intent(in) :: kinematics_length logical, dimension(:,:), allocatable :: myKinematics - end function kinematics_thermal_expansion_init + end function thermalexpansion_init module subroutine kinematics_cleavage_opening_LiAndItsTangent(Ld, dLd_dTstar, S, ph,me) integer, intent(in) :: ph, me @@ -65,28 +71,27 @@ module subroutine eigendeformation_init(phases) print'(/,a)', ' <<<+- phase:mechanics:eigendeformation init -+>>>' !-------------------------------------------------------------------------------------------------- -! initialize kinematic mechanisms - allocate(phase_Nkinematics(phases%length),source = 0) +! explicit eigen mechanisms + allocate(Nmodels(phases%length),source = 0) + do ph = 1,phases%length phase => phases%get(ph) kinematics => phase%get('kinematics',defaultVal=emptyList) - phase_Nkinematics(ph) = kinematics%length - kinematics => phase%get('damage',defaultVal=emptyList) - if(kinematics%length >0) then - damage => kinematics%get(1) - if(damage%get_asString('type',defaultVal='n/a') == 'anisobrittle') phase_Nkinematics(ph) = phase_Nkinematics(ph) +1 - if(damage%get_asString('type',defaultVal='n/a') == 'isoductile' ) phase_Nkinematics(ph) = phase_Nkinematics(ph) +1 - endif + Nmodels(ph) = kinematics%length enddo - allocate(phase_kinematics(maxval(phase_Nkinematics),phases%length), source = KINEMATICS_undefined_ID) + allocate(model(maxval(Nmodels),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 - where(kinematics_thermal_expansion_init(maxval(phase_Nkinematics))) phase_kinematics = KINEMATICS_thermal_expansion_ID + if(maxval(Nmodels) /= 0) then + where(thermalexpansion_init(maxval(Nmodels))) model = KINEMATICS_thermal_expansion_ID endif + allocate(model_damage(phases%length), source = KINEMATICS_UNDEFINED_ID) + + where(kinematics_cleavage_opening_init()) model_damage = KINEMATICS_cleavage_opening_ID + where(kinematics_slipplane_opening_init()) model_damage = KINEMATICS_slipplane_opening_ID + + end subroutine eigendeformation_init @@ -125,11 +130,10 @@ end function kinematics_active !-------------------------------------------------------------------------------------------------- !> @brief checks if a kinematic mechanism is active or not !-------------------------------------------------------------------------------------------------- -function kinematics_active2(kinematics_label,kinematics_length) result(active_kinematics) +function kinematics_active2(kinematics_label) 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 + character(len=*), intent(in) :: kinematics_label !< name of kinematic mechanism + logical, dimension(:), allocatable :: active_kinematics class(tNode), pointer :: & phases, & @@ -139,13 +143,14 @@ function kinematics_active2(kinematics_label,kinematics_length) result(active_k integer :: p phases => config_material%get('phase') - allocate(active_kinematics(kinematics_length,phases%length), source = .false. ) + allocate(active_kinematics(phases%length), source = .false. ) do p = 1, phases%length phase => phases%get(p) kinematics => phase%get('damage',defaultVal=emptyList) + if(kinematics%length < 1) return kinematics_type => kinematics%get(1) if (.not. kinematics_type%contains('type')) continue - active_kinematics(1,p) = kinematics_type%get_asString('type',defaultVal='n/a') == kinematics_label + active_kinematics(p) = kinematics_type%get_asString('type',defaultVal='n/a') == kinematics_label enddo @@ -181,7 +186,9 @@ module subroutine phase_LiAndItsTangents(Li, dLi_dS, dLi_dFi, & detFi integer :: & k, i, j + logical :: active + active = .false. Li = 0.0_pReal dLi_dS = 0.0_pReal dLi_dFi = 0.0_pReal @@ -190,30 +197,37 @@ module subroutine phase_LiAndItsTangents(Li, dLi_dS, dLi_dFi, & plasticType: select case (phase_plasticity(ph)) case (PLASTICITY_isotropic_ID) plasticType call plastic_isotropic_LiAndItsTangent(my_Li, my_dLi_dS, S ,phase_plasticInstance(ph),me) - case default plasticType - my_Li = 0.0_pReal - my_dLi_dS = 0.0_pReal + Li = Li + my_Li + dLi_dS = dLi_dS + my_dLi_dS + active = .true. end select plasticType - Li = Li + my_Li - dLi_dS = dLi_dS + my_dLi_dS - KinematicsLoop: do k = 1, phase_Nkinematics(ph) - kinematicsType: select case (phase_kinematics(k,ph)) - case (KINEMATICS_cleavage_opening_ID) kinematicsType - call kinematics_cleavage_opening_LiAndItsTangent(my_Li, my_dLi_dS, S, ph, me) - case (KINEMATICS_slipplane_opening_ID) kinematicsType - call kinematics_slipplane_opening_LiAndItsTangent(my_Li, my_dLi_dS, S, ph, me) + KinematicsLoop: do k = 1, Nmodels(ph) + kinematicsType: select case (model(k,ph)) case (KINEMATICS_thermal_expansion_ID) kinematicsType call thermalexpansion_LiAndItsTangent(my_Li, my_dLi_dS, ph,me) - case default kinematicsType - my_Li = 0.0_pReal - my_dLi_dS = 0.0_pReal + Li = Li + my_Li + dLi_dS = dLi_dS + my_dLi_dS + active = .true. end select kinematicsType - Li = Li + my_Li - dLi_dS = dLi_dS + my_dLi_dS enddo KinematicsLoop + select case (model_damage(ph)) + case (KINEMATICS_cleavage_opening_ID) + call kinematics_cleavage_opening_LiAndItsTangent(my_Li, my_dLi_dS, S, ph, me) + Li = Li + my_Li + dLi_dS = dLi_dS + my_dLi_dS + active = .true. + case (KINEMATICS_slipplane_opening_ID) + call kinematics_slipplane_opening_LiAndItsTangent(my_Li, my_dLi_dS, S, ph, me) + Li = Li + my_Li + dLi_dS = dLi_dS + my_dLi_dS + active = .true. + end select + + if(.not. active) return + FiInv = math_inv33(Fi) detFi = math_det33(Fi) Li = matmul(matmul(Fi,Li),FiInv)*detFi !< push forward to intermediate configuration diff --git a/src/phase_mechanical_eigen_cleavageopening.f90 b/src/phase_mechanical_eigen_cleavageopening.f90 index 5bb9847f4..aaa1beb97 100644 --- a/src/phase_mechanical_eigen_cleavageopening.f90 +++ b/src/phase_mechanical_eigen_cleavageopening.f90 @@ -28,12 +28,11 @@ contains !> @brief module initialization !> @details reads in material parameters, allocates arrays, and does sanity checks !-------------------------------------------------------------------------------------------------- -module function kinematics_cleavage_opening_init(kinematics_length) result(myKinematics) +module function kinematics_cleavage_opening_init() result(myKinematics) - integer, intent(in) :: kinematics_length - logical, dimension(:,:), allocatable :: myKinematics + logical, dimension(:), allocatable :: myKinematics - integer :: Ninstances,p,k + integer :: p integer, dimension(:), allocatable :: N_cl !< active number of cleavage systems per family character(len=pStringLen) :: extmsg = '' class(tNode), pointer :: & @@ -42,24 +41,24 @@ module function kinematics_cleavage_opening_init(kinematics_length) result(myKin kinematics, & kinematic_type - print'(/,a)', ' <<<+- phase:mechanics:eigendeformation:cleavageopening init -+>>>' - myKinematics = kinematics_active2('anisobrittle',kinematics_length) - Ninstances = count(myKinematics) - print'(a,i2)', ' # instances: ',Ninstances; flush(IO_STDOUT) - if(Ninstances == 0) return + myKinematics = kinematics_active2('anisobrittle') + if(count(myKinematics) == 0) return + + print'(/,a)', ' <<<+- phase:mechanics:eigendeformation:cleavageopening init -+>>>' + print'(a,i2)', ' # phases: ',count(myKinematics); flush(IO_STDOUT) + phases => config_material%get('phase') allocate(param(phases%length)) do p = 1, phases%length - phase => phases%get(p) - if(count(myKinematics(:,p)) == 0) cycle - kinematics => phase%get('damage') - do k = 1, kinematics%length - if(myKinematics(k,p)) then - associate(prm => param(p)) - kinematic_type => kinematics%get(k) + if(myKinematics(p)) then + phase => phases%get(p) + kinematics => phase%get('damage') + + associate(prm => param(p)) + kinematic_type => kinematics%get(1) N_cl = kinematic_type%get_asInts('N_cl') prm%sum_N_cl = sum(abs(N_cl)) @@ -83,9 +82,8 @@ module function kinematics_cleavage_opening_init(kinematics_length) result(myKin !-------------------------------------------------------------------------------------------------- ! exit if any parameter is out of range if (extmsg /= '') call IO_error(211,ext_msg=trim(extmsg)//'(cleavage_opening)') - end associate - endif - enddo + end associate + endif enddo diff --git a/src/phase_mechanical_eigen_slipplaneopening.f90 b/src/phase_mechanical_eigen_slipplaneopening.f90 index 64988d87f..ccba98b14 100644 --- a/src/phase_mechanical_eigen_slipplaneopening.f90 +++ b/src/phase_mechanical_eigen_slipplaneopening.f90 @@ -32,12 +32,11 @@ contains !> @brief module initialization !> @details reads in material parameters, allocates arrays, and does sanity checks !-------------------------------------------------------------------------------------------------- -module function kinematics_slipplane_opening_init(kinematics_length) result(myKinematics) +module function kinematics_slipplane_opening_init() result(myKinematics) - integer, intent(in) :: kinematics_length - logical, dimension(:,:), allocatable :: myKinematics + logical, dimension(:), allocatable :: myKinematics - integer :: Ninstances,p,i,k + integer :: p,i character(len=pStringLen) :: extmsg = '' integer, dimension(:), allocatable :: N_sl real(pReal), dimension(:,:), allocatable :: d,n,t @@ -49,26 +48,26 @@ module function kinematics_slipplane_opening_init(kinematics_length) result(myKi kinematics, & kinematic_type - print'(/,a)', ' <<<+- phase:mechanics:eigendeformation:slipplaneopening init -+>>>' - myKinematics = kinematics_active2('isoductile',kinematics_length) - Ninstances = count(myKinematics) - print'(a,i2)', ' # instances: ',Ninstances; flush(IO_STDOUT) - if(Ninstances == 0) return + myKinematics = kinematics_active2('isoductile') + if(count(myKinematics) == 0) return + print'(/,a)', ' <<<+- phase:mechanics:eigendeformation:slipplaneopening init -+>>>' + print'(a,i2)', ' # phases: ',count(myKinematics); flush(IO_STDOUT) + phases => config_material%get('phase') allocate(param(phases%length)) do p = 1, phases%length - phase => phases%get(p) - mech => phase%get('mechanics') - pl => mech%get('plasticity') - if(count(myKinematics(:,p)) == 0) cycle - kinematics => phase%get('damage') - do k = 1, kinematics%length - if(myKinematics(k,p)) then - associate(prm => param(p)) - kinematic_type => kinematics%get(k) + if(myKinematics(p)) then + phase => phases%get(p) + mech => phase%get('mechanics') + pl => mech%get('plasticity') + + kinematics => phase%get('damage') + + associate(prm => param(p)) + kinematic_type => kinematics%get(1) prm%dot_o = kinematic_type%get_asFloat('dot_o') prm%q = kinematic_type%get_asFloat('q') @@ -103,9 +102,8 @@ module function kinematics_slipplane_opening_init(kinematics_length) result(myKi ! exit if any parameter is out of range if (extmsg /= '') call IO_error(211,ext_msg=trim(extmsg)//'(slipplane_opening)') - end associate - endif - enddo + end associate + endif enddo diff --git a/src/phase_mechanical_eigen_thermalexpansion.f90 b/src/phase_mechanical_eigen_thermalexpansion.f90 index 6630f0eb7..1041e0957 100644 --- a/src/phase_mechanical_eigen_thermalexpansion.f90 +++ b/src/phase_mechanical_eigen_thermalexpansion.f90 @@ -23,7 +23,7 @@ contains !> @brief module initialization !> @details reads in material parameters, allocates arrays, and does sanity checks !-------------------------------------------------------------------------------------------------- -module function kinematics_thermal_expansion_init(kinematics_length) result(myKinematics) +module function thermalexpansion_init(kinematics_length) result(myKinematics) integer, intent(in) :: kinematics_length logical, dimension(:,:), allocatable :: myKinematics @@ -77,7 +77,7 @@ module function kinematics_thermal_expansion_init(kinematics_length) result(myKi enddo -end function kinematics_thermal_expansion_init +end function thermalexpansion_init !-------------------------------------------------------------------------------------------------- diff --git a/src/phase_thermal.f90 b/src/phase_thermal.f90 index 5d3d89ccb..012554aef 100644 --- a/src/phase_thermal.f90 +++ b/src/phase_thermal.f90 @@ -3,6 +3,9 @@ !---------------------------------------------------------------------------------------------------- submodule(phase) thermal + integer, dimension(:), allocatable :: & + thermal_Nsources + type(tSourceState), allocatable, dimension(:) :: & thermalState @@ -36,8 +39,6 @@ submodule(phase) thermal end function externalheat_init - - module subroutine externalheat_dotState(ph, me) integer, intent(in) :: & ph, & diff --git a/src/phase_thermal_dissipation.f90 b/src/phase_thermal_dissipation.f90 index 3c0095401..9c75763dc 100644 --- a/src/phase_thermal_dissipation.f90 +++ b/src/phase_thermal_dissipation.f90 @@ -31,15 +31,14 @@ module function dissipation_init(source_length) result(mySources) phase, & sources, thermal, & src - integer :: Ninstances,so,Nconstituents,ph + integer :: so,Nconstituents,ph - print'(/,a)', ' <<<+- phase:thermal:dissipation init -+>>>' mySources = thermal_active('dissipation',source_length) + if(count(mySources) == 0) return + print'(/,a)', ' <<<+- phase:thermal:dissipation init -+>>>' + print'(a,i2)', ' # phases: ',count(mySources); flush(IO_STDOUT) - Ninstances = count(mySources) - print'(a,i2)', ' # instances: ',Ninstances; flush(IO_STDOUT) - if(Ninstances == 0) return phases => config_material%get('phase') allocate(param(phases%length)) diff --git a/src/phase_thermal_externalheat.f90 b/src/phase_thermal_externalheat.f90 index d2874ded0..c7f894215 100644 --- a/src/phase_thermal_externalheat.f90 +++ b/src/phase_thermal_externalheat.f90 @@ -8,7 +8,7 @@ submodule(phase:thermal) externalheat integer, dimension(:), allocatable :: & - source_thermal_externalheat_offset !< which source is my current thermal dissipation mechanism? + source_thermal_externalheat_offset !< which source is my current thermal dissipation mechanism? type :: tParameters !< container type for internal constitutive parameters real(pReal), dimension(:), allocatable :: & @@ -38,15 +38,14 @@ module function externalheat_init(source_length) result(mySources) phase, & sources, thermal, & src - integer :: Ninstances,so,Nconstituents,ph + integer :: so,Nconstituents,ph - print'(/,a)', ' <<<+- phase:thermal:externalheat init -+>>>' mySources = thermal_active('externalheat',source_length) + if(count(mySources) == 0) return + print'(/,a)', ' <<<+- phase:thermal:externalheat init -+>>>' + print'(a,i2)', ' # phases: ',count(mySources); flush(IO_STDOUT) - Ninstances = count(mySources) - print'(a,i2)', ' # instances: ',Ninstances; flush(IO_STDOUT) - if(Ninstances == 0) return phases => config_material%get('phase') allocate(param(phases%length)) From 8dc53344ecd169fa4885d3f8256b8588e101bbe2 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sat, 13 Feb 2021 18:52:37 +0100 Subject: [PATCH 44/60] 'kinematics'=>'eigen', now part of 'mechanics' --- PRIVATE | 2 +- src/phase_mechanical_eigen.f90 | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/PRIVATE b/PRIVATE index 42ebe55f0..fa5ef6139 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit 42ebe55f0ef1cd799115bd87e45d6025db42f7a7 +Subproject commit fa5ef61395381b103a4babe52be145f960af0bbe diff --git a/src/phase_mechanical_eigen.f90 b/src/phase_mechanical_eigen.f90 index d55ff8759..bee469385 100644 --- a/src/phase_mechanical_eigen.f90 +++ b/src/phase_mechanical_eigen.f90 @@ -66,7 +66,8 @@ module subroutine eigendeformation_init(phases) class(tNode), pointer :: & phase, & kinematics, & - damage + damage, & + mechanics print'(/,a)', ' <<<+- phase:mechanics:eigendeformation init -+>>>' @@ -76,7 +77,8 @@ module subroutine eigendeformation_init(phases) do ph = 1,phases%length phase => phases%get(ph) - kinematics => phase%get('kinematics',defaultVal=emptyList) + mechanics => phase%get('mechanics') + kinematics => mechanics%get('eigen',defaultVal=emptyList) Nmodels(ph) = kinematics%length enddo @@ -108,14 +110,16 @@ function kinematics_active(kinematics_label,kinematics_length) result(active_ki phases, & phase, & kinematics, & - kinematics_type + kinematics_type, & + mechanics integer :: p,k phases => config_material%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) + mechanics => phase%get('mechanics') + kinematics => mechanics%get('eigen',defaultVal=emptyList) do k = 1, kinematics%length kinematics_type => kinematics%get(k) active_kinematics(k,p) = kinematics_type%get_asString('type') == kinematics_label From 9481b168789de60187a0232789043c7ca58345b2 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sat, 13 Feb 2021 18:57:41 +0100 Subject: [PATCH 45/60] missing renames --- src/homogenization_mechanical.f90 | 6 ++--- src/homogenization_mechanical_RGC.f90 | 4 +-- src/homogenization_mechanical_isostrain.f90 | 4 +-- src/homogenization_mechanical_pass.f90 | 4 +-- src/phase.f90 | 21 +++++++++++++++ src/phase_mechanical.f90 | 6 ++--- src/phase_mechanical_eigen.f90 | 26 +++---------------- ...phase_mechanical_eigen_cleavageopening.f90 | 4 +-- ...hase_mechanical_eigen_slipplaneopening.f90 | 4 +-- ...hase_mechanical_eigen_thermalexpansion.f90 | 4 +-- src/phase_mechanical_plastic.f90 | 4 +-- ...phase_mechanical_plastic_dislotungsten.f90 | 2 +- src/phase_mechanical_plastic_dislotwin.f90 | 2 +- src/phase_mechanical_plastic_isotropic.f90 | 2 +- ...phase_mechanical_plastic_kinehardening.f90 | 2 +- src/phase_mechanical_plastic_none.f90 | 2 +- src/phase_mechanical_plastic_nonlocal.f90 | 2 +- ...phase_mechanical_plastic_phenopowerlaw.f90 | 2 +- 18 files changed, 51 insertions(+), 50 deletions(-) diff --git a/src/homogenization_mechanical.f90 b/src/homogenization_mechanical.f90 index c05b576da..a19a61f72 100644 --- a/src/homogenization_mechanical.f90 +++ b/src/homogenization_mechanical.f90 @@ -2,7 +2,7 @@ !> @author Martin Diehl, KU Leuven !> @brief Partition F and homogenize P/dPdF !-------------------------------------------------------------------------------------------------- -submodule(homogenization) mechanics +submodule(homogenization) mechanical interface @@ -86,7 +86,7 @@ module subroutine mechanical_init(num_homog) class(tNode), pointer :: & num_homogMech - print'(/,a)', ' <<<+- homogenization:mechanics init -+>>>' + print'(/,a)', ' <<<+- homogenization:mechanical init -+>>>' allocate(homogenization_dPdF(3,3,3,3,discretization_nIPs*discretization_Nelems), source=0.0_pReal) homogenization_F0 = spread(math_I3,3,discretization_nIPs*discretization_Nelems) ! initialize to identity @@ -251,4 +251,4 @@ module subroutine mechanical_results(group_base,h) end subroutine mechanical_results -end submodule mechanics +end submodule mechanical diff --git a/src/homogenization_mechanical_RGC.f90 b/src/homogenization_mechanical_RGC.f90 index 546c2b65c..f1bcda380 100644 --- a/src/homogenization_mechanical_RGC.f90 +++ b/src/homogenization_mechanical_RGC.f90 @@ -6,7 +6,7 @@ !> @brief Relaxed grain cluster (RGC) homogenization scheme !> N_constituents is defined as p x q x r (cluster) !-------------------------------------------------------------------------------------------------- -submodule(homogenization:mechanics) RGC +submodule(homogenization:mechanical) RGC use rotations use lattice @@ -88,7 +88,7 @@ module subroutine mechanical_RGC_init(num_homogMech) homog, & homogMech - print'(/,a)', ' <<<+- homogenization:mechanics:RGC init -+>>>' + print'(/,a)', ' <<<+- homogenization:mechanical:RGC init -+>>>' Ninstances = count(homogenization_type == HOMOGENIZATION_RGC_ID) print'(a,i2)', ' # instances: ',Ninstances; flush(IO_STDOUT) diff --git a/src/homogenization_mechanical_isostrain.f90 b/src/homogenization_mechanical_isostrain.f90 index f9616de42..b492499d8 100644 --- a/src/homogenization_mechanical_isostrain.f90 +++ b/src/homogenization_mechanical_isostrain.f90 @@ -4,7 +4,7 @@ !> @author Philip Eisenlohr, Max-Planck-Institut für Eisenforschung GmbH !> @brief Isostrain (full constraint Taylor assuption) homogenization scheme !-------------------------------------------------------------------------------------------------- -submodule(homogenization:mechanics) isostrain +submodule(homogenization:mechanical) isostrain enum, bind(c); enumerator :: & parallel_ID, & @@ -37,7 +37,7 @@ module subroutine mechanical_isostrain_init homog, & homogMech - print'(/,a)', ' <<<+- homogenization:mechanics:isostrain init -+>>>' + print'(/,a)', ' <<<+- homogenization:mechanical:isostrain init -+>>>' Ninstances = count(homogenization_type == HOMOGENIZATION_ISOSTRAIN_ID) print'(a,i2)', ' # instances: ',Ninstances; flush(IO_STDOUT) diff --git a/src/homogenization_mechanical_pass.f90 b/src/homogenization_mechanical_pass.f90 index 9e8f3e44c..6217e6836 100644 --- a/src/homogenization_mechanical_pass.f90 +++ b/src/homogenization_mechanical_pass.f90 @@ -4,7 +4,7 @@ !> @author Martin Diehl, Max-Planck-Institut für Eisenforschung GmbH !> @brief dummy homogenization homogenization scheme for 1 constituent per material point !-------------------------------------------------------------------------------------------------- -submodule(homogenization:mechanics) none +submodule(homogenization:mechanical) none contains @@ -18,7 +18,7 @@ module subroutine mechanical_pass_init h, & Nmaterialpoints - print'(/,a)', ' <<<+- homogenization:mechanics:pass init -+>>>' + print'(/,a)', ' <<<+- homogenization:mechanical:pass init -+>>>' Ninstances = count(homogenization_type == HOMOGENIZATION_NONE_ID) print'(a,i2)', ' # instances: ',Ninstances; flush(IO_STDOUT) diff --git a/src/phase.f90 b/src/phase.f90 index eb6e61eb8..f129ba92f 100644 --- a/src/phase.f90 +++ b/src/phase.f90 @@ -263,6 +263,27 @@ module phase el !< element end subroutine plastic_dependentState + + module subroutine kinematics_cleavage_opening_LiAndItsTangent(Ld, dLd_dTstar, S, ph,me) + integer, intent(in) :: ph, me + real(pReal), intent(in), dimension(3,3) :: & + S + real(pReal), intent(out), dimension(3,3) :: & + Ld !< damage velocity gradient + real(pReal), intent(out), dimension(3,3,3,3) :: & + dLd_dTstar !< derivative of Ld with respect to Tstar (4th-order tensor) + end subroutine kinematics_cleavage_opening_LiAndItsTangent + + module subroutine kinematics_slipplane_opening_LiAndItsTangent(Ld, dLd_dTstar, S, ph,me) + integer, intent(in) :: ph, me + real(pReal), intent(in), dimension(3,3) :: & + S + real(pReal), intent(out), dimension(3,3) :: & + Ld !< damage velocity gradient + real(pReal), intent(out), dimension(3,3,3,3) :: & + dLd_dTstar !< derivative of Ld with respect to Tstar (4th-order tensor) + end subroutine kinematics_slipplane_opening_LiAndItsTangent + end interface diff --git a/src/phase_mechanical.f90 b/src/phase_mechanical.f90 index ef962b7e6..c10a916da 100644 --- a/src/phase_mechanical.f90 +++ b/src/phase_mechanical.f90 @@ -1,7 +1,7 @@ !---------------------------------------------------------------------------------------------------- !> @brief internal microstructure state for all plasticity constitutive models !---------------------------------------------------------------------------------------------------- -submodule(phase) mechanics +submodule(phase) mechanical enum, bind(c); enumerator :: & @@ -202,7 +202,7 @@ module subroutine mechanical_init(phases) elastic, & stiffDegradation - print'(/,a)', ' <<<+- phase:mechanics init -+>>>' + print'(/,a)', ' <<<+- phase:mechanical init -+>>>' !------------------------------------------------------------------------------------------------- ! initialize elasticity (hooke) !ToDO: Maybe move to elastic submodule along with function homogenizedC? @@ -1499,4 +1499,4 @@ module subroutine phase_mechanical_setF(F,co,ip,el) end subroutine phase_mechanical_setF -end submodule mechanics +end submodule mechanical diff --git a/src/phase_mechanical_eigen.f90 b/src/phase_mechanical_eigen.f90 index bee469385..bee7dc2d2 100644 --- a/src/phase_mechanical_eigen.f90 +++ b/src/phase_mechanical_eigen.f90 @@ -1,4 +1,4 @@ -submodule(phase:mechanics) eigendeformation +submodule(phase:mechanical) eigen integer, dimension(:), allocatable :: & Nmodels @@ -22,26 +22,6 @@ submodule(phase:mechanics) eigendeformation logical, dimension(:,:), allocatable :: myKinematics end function thermalexpansion_init - module subroutine kinematics_cleavage_opening_LiAndItsTangent(Ld, dLd_dTstar, S, ph,me) - integer, intent(in) :: ph, me - real(pReal), intent(in), dimension(3,3) :: & - S - real(pReal), intent(out), dimension(3,3) :: & - Ld !< damage velocity gradient - real(pReal), intent(out), dimension(3,3,3,3) :: & - dLd_dTstar !< derivative of Ld with respect to Tstar (4th-order tensor) - end subroutine kinematics_cleavage_opening_LiAndItsTangent - - module subroutine kinematics_slipplane_opening_LiAndItsTangent(Ld, dLd_dTstar, S, ph,me) - integer, intent(in) :: ph, me - real(pReal), intent(in), dimension(3,3) :: & - S - real(pReal), intent(out), dimension(3,3) :: & - Ld !< damage velocity gradient - real(pReal), intent(out), dimension(3,3,3,3) :: & - dLd_dTstar !< derivative of Ld with respect to Tstar (4th-order tensor) - end subroutine kinematics_slipplane_opening_LiAndItsTangent - module subroutine thermalexpansion_LiAndItsTangent(Li, dLi_dTstar, ph,me) integer, intent(in) :: ph, me real(pReal), intent(out), dimension(3,3) :: & @@ -69,7 +49,7 @@ module subroutine eigendeformation_init(phases) damage, & mechanics - print'(/,a)', ' <<<+- phase:mechanics:eigendeformation init -+>>>' + print'(/,a)', ' <<<+- phase:mechanical:eigen init -+>>>' !-------------------------------------------------------------------------------------------------- ! explicit eigen mechanisms @@ -246,4 +226,4 @@ module subroutine phase_LiAndItsTangents(Li, dLi_dS, dLi_dFi, & end subroutine phase_LiAndItsTangents -end submodule eigendeformation +end submodule eigen diff --git a/src/phase_mechanical_eigen_cleavageopening.f90 b/src/phase_mechanical_eigen_cleavageopening.f90 index aaa1beb97..9f29b1634 100644 --- a/src/phase_mechanical_eigen_cleavageopening.f90 +++ b/src/phase_mechanical_eigen_cleavageopening.f90 @@ -4,7 +4,7 @@ !> @brief material subroutine incorporating kinematics resulting from opening of cleavage planes !> @details to be done !-------------------------------------------------------------------------------------------------- -submodule(phase:eigendeformation) cleavageopening +submodule(phase:eigen) cleavageopening type :: tParameters !< container type for internal constitutive parameters integer :: & @@ -45,7 +45,7 @@ module function kinematics_cleavage_opening_init() result(myKinematics) myKinematics = kinematics_active2('anisobrittle') if(count(myKinematics) == 0) return - print'(/,a)', ' <<<+- phase:mechanics:eigendeformation:cleavageopening init -+>>>' + print'(/,a)', ' <<<+- phase:mechanical:eigen:cleavageopening init -+>>>' print'(a,i2)', ' # phases: ',count(myKinematics); flush(IO_STDOUT) diff --git a/src/phase_mechanical_eigen_slipplaneopening.f90 b/src/phase_mechanical_eigen_slipplaneopening.f90 index ccba98b14..e8a7d65b9 100644 --- a/src/phase_mechanical_eigen_slipplaneopening.f90 +++ b/src/phase_mechanical_eigen_slipplaneopening.f90 @@ -4,7 +4,7 @@ !> @brief material subroutine incorporating kinematics resulting from opening of slip planes !> @details to be done !-------------------------------------------------------------------------------------------------- -submodule(phase:eigendeformation) slipplaneopening +submodule(phase:eigen) slipplaneopening integer, dimension(:), allocatable :: kinematics_slipplane_opening_instance @@ -51,7 +51,7 @@ module function kinematics_slipplane_opening_init() result(myKinematics) myKinematics = kinematics_active2('isoductile') if(count(myKinematics) == 0) return - print'(/,a)', ' <<<+- phase:mechanics:eigendeformation:slipplaneopening init -+>>>' + print'(/,a)', ' <<<+- phase:mechanical:eigen:slipplaneopening init -+>>>' print'(a,i2)', ' # phases: ',count(myKinematics); flush(IO_STDOUT) diff --git a/src/phase_mechanical_eigen_thermalexpansion.f90 b/src/phase_mechanical_eigen_thermalexpansion.f90 index 1041e0957..86e7fa907 100644 --- a/src/phase_mechanical_eigen_thermalexpansion.f90 +++ b/src/phase_mechanical_eigen_thermalexpansion.f90 @@ -3,7 +3,7 @@ !> @brief material subroutine incorporating kinematics resulting from thermal expansion !> @details to be done !-------------------------------------------------------------------------------------------------- -submodule(phase:eigendeformation) thermalexpansion +submodule(phase:eigen) thermalexpansion integer, dimension(:), allocatable :: kinematics_thermal_expansion_instance @@ -36,7 +36,7 @@ module function thermalexpansion_init(kinematics_length) result(myKinematics) kinematics, & kinematic_type - print'(/,a)', ' <<<+- phase:mechanics:eigendeformation:thermalexpansion init -+>>>' + print'(/,a)', ' <<<+- phase:mechanical:eigen:thermalexpansion init -+>>>' myKinematics = kinematics_active('thermal_expansion',kinematics_length) Ninstances = count(myKinematics) diff --git a/src/phase_mechanical_plastic.f90 b/src/phase_mechanical_plastic.f90 index ed1dc64fb..843273c72 100644 --- a/src/phase_mechanical_plastic.f90 +++ b/src/phase_mechanical_plastic.f90 @@ -1,4 +1,4 @@ -submodule(phase:mechanics) plastic +submodule(phase:mechanical) plastic interface @@ -226,7 +226,7 @@ contains module subroutine plastic_init - print'(/,a)', ' <<<+- phase:mechanics:plastic init -+>>>' + print'(/,a)', ' <<<+- phase:mechanical:plastic init -+>>>' where(plastic_none_init()) phase_plasticity = PLASTICITY_NONE_ID where(plastic_isotropic_init()) phase_plasticity = PLASTICITY_ISOTROPIC_ID diff --git a/src/phase_mechanical_plastic_dislotungsten.f90 b/src/phase_mechanical_plastic_dislotungsten.f90 index 4db546b67..6eb1e4abe 100644 --- a/src/phase_mechanical_plastic_dislotungsten.f90 +++ b/src/phase_mechanical_plastic_dislotungsten.f90 @@ -101,7 +101,7 @@ module function plastic_dislotungsten_init() result(myPlasticity) Ninstances = count(myPlasticity) if(Ninstances == 0) return - print'(/,a)', ' <<<+- phase:mechanics:plastic:dislotungsten init -+>>>' + print'(/,a)', ' <<<+- phase:mechanical:plastic:dislotungsten init -+>>>' print'(a,i0)', ' # phases: ',Ninstances; flush(IO_STDOUT) diff --git a/src/phase_mechanical_plastic_dislotwin.f90 b/src/phase_mechanical_plastic_dislotwin.f90 index 2a011dfda..ca385f417 100644 --- a/src/phase_mechanical_plastic_dislotwin.f90 +++ b/src/phase_mechanical_plastic_dislotwin.f90 @@ -148,7 +148,7 @@ module function plastic_dislotwin_init() result(myPlasticity) Ninstances = count(myPlasticity) if(Ninstances == 0) return - print'(/,a)', ' <<<+- phase:mechanics:plastic:dislotwin init -+>>>' + print'(/,a)', ' <<<+- phase:mechanical:plastic:dislotwin init -+>>>' print'(a,i0)', ' # phases: ',Ninstances; flush(IO_STDOUT) print*, 'Ma and Roters, Acta Materialia 52(12):3603–3612, 2004' diff --git a/src/phase_mechanical_plastic_isotropic.f90 b/src/phase_mechanical_plastic_isotropic.f90 index 4cb1bf28c..e315a38fb 100644 --- a/src/phase_mechanical_plastic_isotropic.f90 +++ b/src/phase_mechanical_plastic_isotropic.f90 @@ -72,7 +72,7 @@ module function plastic_isotropic_init() result(myPlasticity) Ninstances = count(myPlasticity) if(Ninstances == 0) return - print'(/,a)', ' <<<+- phase:mechanics:plastic:isotropic init -+>>>' + print'(/,a)', ' <<<+- phase:mechanical:plastic:isotropic init -+>>>' print'(a,i0)', ' # phses: ',Ninstances; flush(IO_STDOUT) diff --git a/src/phase_mechanical_plastic_kinehardening.f90 b/src/phase_mechanical_plastic_kinehardening.f90 index 0ef762ffe..1244988de 100644 --- a/src/phase_mechanical_plastic_kinehardening.f90 +++ b/src/phase_mechanical_plastic_kinehardening.f90 @@ -84,7 +84,7 @@ module function plastic_kinehardening_init() result(myPlasticity) Ninstances = count(myPlasticity) if(Ninstances == 0) return - print'(/,a)', ' <<<+- phase:mechanics:plastic:kinehardening init -+>>>' + print'(/,a)', ' <<<+- phase:mechanical:plastic:kinehardening init -+>>>' print'(a,i0)', ' # phases: ',Ninstances; flush(IO_STDOUT) diff --git a/src/phase_mechanical_plastic_none.f90 b/src/phase_mechanical_plastic_none.f90 index f16cf98fb..1510262cc 100644 --- a/src/phase_mechanical_plastic_none.f90 +++ b/src/phase_mechanical_plastic_none.f90 @@ -25,7 +25,7 @@ module function plastic_none_init() result(myPlasticity) myPlasticity = plastic_active('none') if(count(myPlasticity) == 0) return - print'(/,a)', ' <<<+- phase:mechanics:plastic:none init -+>>>' + print'(/,a)', ' <<<+- phase:mechanical:plastic:none init -+>>>' print'(a,i0)', ' # phases: ',count(myPlasticity); flush(IO_STDOUT) phases => config_material%get('phase') diff --git a/src/phase_mechanical_plastic_nonlocal.f90 b/src/phase_mechanical_plastic_nonlocal.f90 index 5cfd9cf4d..4e94f83ae 100644 --- a/src/phase_mechanical_plastic_nonlocal.f90 +++ b/src/phase_mechanical_plastic_nonlocal.f90 @@ -194,7 +194,7 @@ module function plastic_nonlocal_init() result(myPlasticity) return endif - print'(/,a)', ' <<<+- phase:mechanics:plastic:nonlocal init -+>>>' + print'(/,a)', ' <<<+- phase:mechanical:plastic:nonlocal init -+>>>' print'(a,i0)', ' # phases: ',Ninstances; flush(IO_STDOUT) print*, 'Reuber et al., Acta Materialia 71:333–348, 2014' diff --git a/src/phase_mechanical_plastic_phenopowerlaw.f90 b/src/phase_mechanical_plastic_phenopowerlaw.f90 index 6a7d5ea7f..bea7ef06b 100644 --- a/src/phase_mechanical_plastic_phenopowerlaw.f90 +++ b/src/phase_mechanical_plastic_phenopowerlaw.f90 @@ -94,7 +94,7 @@ module function plastic_phenopowerlaw_init() result(myPlasticity) Ninstances = count(myPlasticity) if(Ninstances == 0) return - print'(/,a)', ' <<<+- phase:mechanics:plastic:phenopowerlaw init -+>>>' + print'(/,a)', ' <<<+- phase:mechanical:plastic:phenopowerlaw init -+>>>' print'(a,i0)', ' # phases: ',Ninstances; flush(IO_STDOUT) From 5126370934dfcfc66dc808a05128ae2843a0be41 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sat, 13 Feb 2021 19:20:52 +0100 Subject: [PATCH 46/60] cleavageopening+anisobrittle are strongly coupled --- src/phase_damage_anisobrittle.f90 | 62 +++++++++ ...phase_mechanical_eigen_cleavageopening.f90 | 122 ------------------ 2 files changed, 62 insertions(+), 122 deletions(-) diff --git a/src/phase_damage_anisobrittle.f90 b/src/phase_damage_anisobrittle.f90 index bfd069031..fd82b74c4 100644 --- a/src/phase_damage_anisobrittle.f90 +++ b/src/phase_damage_anisobrittle.f90 @@ -193,4 +193,66 @@ module subroutine anisobrittle_results(phase,group) end subroutine anisobrittle_results + +!-------------------------------------------------------------------------------------------------- +!> @brief contains the constitutive equation for calculating the velocity gradient +!-------------------------------------------------------------------------------------------------- +module subroutine kinematics_cleavage_opening_LiAndItsTangent(Ld, dLd_dTstar, S, ph,me) + + integer, intent(in) :: & + ph,me + real(pReal), intent(in), dimension(3,3) :: & + S + real(pReal), intent(out), dimension(3,3) :: & + Ld !< damage velocity gradient + real(pReal), intent(out), dimension(3,3,3,3) :: & + dLd_dTstar !< derivative of Ld with respect to Tstar (4th-order tensor) + + integer :: & + i, k, l, m, n + real(pReal) :: & + traction_d, traction_t, traction_n, traction_crit, & + udotd, dudotd_dt, udott, dudott_dt, udotn, dudotn_dt + + + Ld = 0.0_pReal + dLd_dTstar = 0.0_pReal + associate(prm => param(ph)) + do i = 1,prm%sum_N_cl + traction_crit = prm%g_crit(i)*damage_phi(ph,me)**2.0_pReal + + traction_d = math_tensordot(S,prm%cleavage_systems(1:3,1:3,1,i)) + if (abs(traction_d) > traction_crit + tol_math_check) then + udotd = sign(1.0_pReal,traction_d)* prm%dot_o * ((abs(traction_d) - traction_crit)/traction_crit)**prm%q + Ld = Ld + udotd*prm%cleavage_systems(1:3,1:3,1,i) + dudotd_dt = sign(1.0_pReal,traction_d)*udotd*prm%q / (abs(traction_d) - traction_crit) + forall (k=1:3,l=1:3,m=1:3,n=1:3) & + dLd_dTstar(k,l,m,n) = dLd_dTstar(k,l,m,n) & + + dudotd_dt*prm%cleavage_systems(k,l,1,i) * prm%cleavage_systems(m,n,1,i) + endif + + traction_t = math_tensordot(S,prm%cleavage_systems(1:3,1:3,2,i)) + if (abs(traction_t) > traction_crit + tol_math_check) then + udott = sign(1.0_pReal,traction_t)* prm%dot_o * ((abs(traction_t) - traction_crit)/traction_crit)**prm%q + Ld = Ld + udott*prm%cleavage_systems(1:3,1:3,2,i) + dudott_dt = sign(1.0_pReal,traction_t)*udott*prm%q / (abs(traction_t) - traction_crit) + forall (k=1:3,l=1:3,m=1:3,n=1:3) & + dLd_dTstar(k,l,m,n) = dLd_dTstar(k,l,m,n) & + + dudott_dt*prm%cleavage_systems(k,l,2,i) * prm%cleavage_systems(m,n,2,i) + endif + + traction_n = math_tensordot(S,prm%cleavage_systems(1:3,1:3,3,i)) + if (abs(traction_n) > traction_crit + tol_math_check) then + udotn = sign(1.0_pReal,traction_n)* prm%dot_o * ((abs(traction_n) - traction_crit)/traction_crit)**prm%q + Ld = Ld + udotn*prm%cleavage_systems(1:3,1:3,3,i) + dudotn_dt = sign(1.0_pReal,traction_n)*udotn*prm%q / (abs(traction_n) - traction_crit) + forall (k=1:3,l=1:3,m=1:3,n=1:3) & + dLd_dTstar(k,l,m,n) = dLd_dTstar(k,l,m,n) & + + dudotn_dt*prm%cleavage_systems(k,l,3,i) * prm%cleavage_systems(m,n,3,i) + endif + enddo + end associate + +end subroutine kinematics_cleavage_opening_LiAndItsTangent + end submodule anisobrittle diff --git a/src/phase_mechanical_eigen_cleavageopening.f90 b/src/phase_mechanical_eigen_cleavageopening.f90 index 9f29b1634..0f48be1a4 100644 --- a/src/phase_mechanical_eigen_cleavageopening.f90 +++ b/src/phase_mechanical_eigen_cleavageopening.f90 @@ -6,21 +6,6 @@ !-------------------------------------------------------------------------------------------------- submodule(phase:eigen) cleavageopening - type :: tParameters !< container type for internal constitutive parameters - integer :: & - sum_N_cl !< total number of cleavage planes - real(pReal) :: & - dot_o, & !< opening rate of cleavage planes - q !< damage rate sensitivity - real(pReal), dimension(:), allocatable :: & - g_crit - real(pReal), dimension(:,:,:,:), allocatable :: & - cleavage_systems - end type tParameters - - type(tParameters), dimension(:), allocatable :: param !< containers of constitutive parameters - - contains @@ -32,15 +17,6 @@ module function kinematics_cleavage_opening_init() result(myKinematics) logical, dimension(:), allocatable :: myKinematics - integer :: p - integer, dimension(:), allocatable :: N_cl !< active number of cleavage systems per family - character(len=pStringLen) :: extmsg = '' - class(tNode), pointer :: & - phases, & - phase, & - kinematics, & - kinematic_type - myKinematics = kinematics_active2('anisobrittle') if(count(myKinematics) == 0) return @@ -48,107 +24,9 @@ module function kinematics_cleavage_opening_init() result(myKinematics) print'(/,a)', ' <<<+- phase:mechanical:eigen:cleavageopening init -+>>>' print'(a,i2)', ' # phases: ',count(myKinematics); flush(IO_STDOUT) - - phases => config_material%get('phase') - allocate(param(phases%length)) - - do p = 1, phases%length - if(myKinematics(p)) then - phase => phases%get(p) - kinematics => phase%get('damage') - - associate(prm => param(p)) - kinematic_type => kinematics%get(1) - - N_cl = kinematic_type%get_asInts('N_cl') - prm%sum_N_cl = sum(abs(N_cl)) - - prm%q = kinematic_type%get_asFloat('q') - prm%dot_o = kinematic_type%get_asFloat('dot_o') - - prm%g_crit = kinematic_type%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%g_crit = math_expand(prm%g_crit,N_cl) - - ! sanity checks - if (prm%q <= 0.0_pReal) extmsg = trim(extmsg)//' q' - if (prm%dot_o <= 0.0_pReal) extmsg = trim(extmsg)//' dot_o' - if (any(prm%g_crit < 0.0_pReal)) extmsg = trim(extmsg)//' g_crit' - -!-------------------------------------------------------------------------------------------------- -! exit if any parameter is out of range - if (extmsg /= '') call IO_error(211,ext_msg=trim(extmsg)//'(cleavage_opening)') - end associate - endif - enddo - - end function kinematics_cleavage_opening_init -!-------------------------------------------------------------------------------------------------- -!> @brief contains the constitutive equation for calculating the velocity gradient -!-------------------------------------------------------------------------------------------------- -module subroutine kinematics_cleavage_opening_LiAndItsTangent(Ld, dLd_dTstar, S, ph,me) - integer, intent(in) :: & - ph,me - real(pReal), intent(in), dimension(3,3) :: & - S - real(pReal), intent(out), dimension(3,3) :: & - Ld !< damage velocity gradient - real(pReal), intent(out), dimension(3,3,3,3) :: & - dLd_dTstar !< derivative of Ld with respect to Tstar (4th-order tensor) - - integer :: & - i, k, l, m, n - real(pReal) :: & - traction_d, traction_t, traction_n, traction_crit, & - udotd, dudotd_dt, udott, dudott_dt, udotn, dudotn_dt - - - Ld = 0.0_pReal - dLd_dTstar = 0.0_pReal - associate(prm => param(ph)) - do i = 1,prm%sum_N_cl - traction_crit = prm%g_crit(i)*damage_phi(ph,me)**2.0_pReal - - traction_d = math_tensordot(S,prm%cleavage_systems(1:3,1:3,1,i)) - if (abs(traction_d) > traction_crit + tol_math_check) then - udotd = sign(1.0_pReal,traction_d)* prm%dot_o * ((abs(traction_d) - traction_crit)/traction_crit)**prm%q - Ld = Ld + udotd*prm%cleavage_systems(1:3,1:3,1,i) - dudotd_dt = sign(1.0_pReal,traction_d)*udotd*prm%q / (abs(traction_d) - traction_crit) - forall (k=1:3,l=1:3,m=1:3,n=1:3) & - dLd_dTstar(k,l,m,n) = dLd_dTstar(k,l,m,n) & - + dudotd_dt*prm%cleavage_systems(k,l,1,i) * prm%cleavage_systems(m,n,1,i) - endif - - traction_t = math_tensordot(S,prm%cleavage_systems(1:3,1:3,2,i)) - if (abs(traction_t) > traction_crit + tol_math_check) then - udott = sign(1.0_pReal,traction_t)* prm%dot_o * ((abs(traction_t) - traction_crit)/traction_crit)**prm%q - Ld = Ld + udott*prm%cleavage_systems(1:3,1:3,2,i) - dudott_dt = sign(1.0_pReal,traction_t)*udott*prm%q / (abs(traction_t) - traction_crit) - forall (k=1:3,l=1:3,m=1:3,n=1:3) & - dLd_dTstar(k,l,m,n) = dLd_dTstar(k,l,m,n) & - + dudott_dt*prm%cleavage_systems(k,l,2,i) * prm%cleavage_systems(m,n,2,i) - endif - - traction_n = math_tensordot(S,prm%cleavage_systems(1:3,1:3,3,i)) - if (abs(traction_n) > traction_crit + tol_math_check) then - udotn = sign(1.0_pReal,traction_n)* prm%dot_o * ((abs(traction_n) - traction_crit)/traction_crit)**prm%q - Ld = Ld + udotn*prm%cleavage_systems(1:3,1:3,3,i) - dudotn_dt = sign(1.0_pReal,traction_n)*udotn*prm%q / (abs(traction_n) - traction_crit) - forall (k=1:3,l=1:3,m=1:3,n=1:3) & - dLd_dTstar(k,l,m,n) = dLd_dTstar(k,l,m,n) & - + dudotn_dt*prm%cleavage_systems(k,l,3,i) * prm%cleavage_systems(m,n,3,i) - endif - enddo - end associate - -end subroutine kinematics_cleavage_opening_LiAndItsTangent end submodule cleavageopening From a34edda4d9c7098543980b9caca91ca15cf97d47 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sat, 13 Feb 2021 22:06:44 +0100 Subject: [PATCH 47/60] fixed test for damage --- PRIVATE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PRIVATE b/PRIVATE index fa5ef6139..2ed5cd4ba 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit fa5ef61395381b103a4babe52be145f960af0bbe +Subproject commit 2ed5cd4ba97b44ad9c8b61ced94060aee57a2dd8 From c09c2a6c8e123d42ee33527675a5096275cdf236 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 14 Feb 2021 00:50:42 +0100 Subject: [PATCH 48/60] easier to read without instance --- src/phase_mechanical.f90 | 12 +-- src/phase_mechanical_plastic.f90 | 6 +- ...phase_mechanical_plastic_kinehardening.f90 | 73 ++++++++----------- ...phase_mechanical_plastic_phenopowerlaw.f90 | 69 +++++++++--------- 4 files changed, 74 insertions(+), 86 deletions(-) diff --git a/src/phase_mechanical.f90 b/src/phase_mechanical.f90 index c10a916da..ae3967b26 100644 --- a/src/phase_mechanical.f90 +++ b/src/phase_mechanical.f90 @@ -135,13 +135,13 @@ submodule(phase) mechanical character(len=*), intent(in) :: group end subroutine plastic_isotropic_results - module subroutine plastic_phenopowerlaw_results(instance,group) - integer, intent(in) :: instance + module subroutine plastic_phenopowerlaw_results(ph,group) + integer, intent(in) :: ph character(len=*), intent(in) :: group end subroutine plastic_phenopowerlaw_results - module subroutine plastic_kinehardening_results(instance,group) - integer, intent(in) :: instance + module subroutine plastic_kinehardening_results(ph,group) + integer, intent(in) :: ph character(len=*), intent(in) :: group end subroutine plastic_kinehardening_results @@ -406,10 +406,10 @@ module subroutine mechanical_results(group,ph) call plastic_isotropic_results(phase_plasticInstance(ph),group//'plastic/') case(PLASTICITY_PHENOPOWERLAW_ID) - call plastic_phenopowerlaw_results(phase_plasticInstance(ph),group//'plastic/') + call plastic_phenopowerlaw_results(ph,group//'plastic/') case(PLASTICITY_KINEHARDENING_ID) - call plastic_kinehardening_results(phase_plasticInstance(ph),group//'plastic/') + call plastic_kinehardening_results(ph,group//'plastic/') case(PLASTICITY_DISLOTWIN_ID) call plastic_dislotwin_results(phase_plasticInstance(ph),group//'plastic/') diff --git a/src/phase_mechanical_plastic.f90 b/src/phase_mechanical_plastic.f90 index 843273c72..b08e27276 100644 --- a/src/phase_mechanical_plastic.f90 +++ b/src/phase_mechanical_plastic.f90 @@ -201,11 +201,11 @@ submodule(phase:mechanical) plastic el !< current element number end subroutine nonlocal_dependentState - module subroutine plastic_kinehardening_deltaState(Mp,instance,me) + module subroutine plastic_kinehardening_deltaState(Mp,ph,me) real(pReal), dimension(3,3), intent(in) :: & Mp !< Mandel stress integer, intent(in) :: & - instance, & + ph, & me end subroutine plastic_kinehardening_deltaState @@ -417,7 +417,7 @@ module function plastic_deltaState(co, ip, el, ph, me) result(broken) plasticType: select case (phase_plasticity(ph)) case (PLASTICITY_KINEHARDENING_ID) plasticType - call plastic_kinehardening_deltaState(Mp,instance,me) + call plastic_kinehardening_deltaState(Mp,ph,me) broken = any(IEEE_is_NaN(plasticState(ph)%deltaState(:,me))) case (PLASTICITY_NONLOCAL_ID) plasticType diff --git a/src/phase_mechanical_plastic_kinehardening.f90 b/src/phase_mechanical_plastic_kinehardening.f90 index 1244988de..14aa58fb9 100644 --- a/src/phase_mechanical_plastic_kinehardening.f90 +++ b/src/phase_mechanical_plastic_kinehardening.f90 @@ -62,7 +62,6 @@ module function plastic_kinehardening_init() result(myPlasticity) logical, dimension(:), allocatable :: myPlasticity integer :: & - Ninstances, & p, i, o, & Nconstituents, & sizeState, sizeDeltaState, sizeDotState, & @@ -81,25 +80,24 @@ module function plastic_kinehardening_init() result(myPlasticity) pl myPlasticity = plastic_active('kinehardening') - Ninstances = count(myPlasticity) - if(Ninstances == 0) return + if(count(myPlasticity) == 0) return print'(/,a)', ' <<<+- phase:mechanical:plastic:kinehardening init -+>>>' - print'(a,i0)', ' # phases: ',Ninstances; flush(IO_STDOUT) + print'(a,i0)', ' # phases: ',count(myPlasticity); flush(IO_STDOUT) - allocate(param(Ninstances)) - allocate(state(Ninstances)) - allocate(dotState(Ninstances)) - allocate(deltaState(Ninstances)) - phases => config_material%get('phase') - i = 0 + allocate(param(phases%length)) + allocate(state(phases%length)) + allocate(dotState(phases%length)) + allocate(deltaState(phases%length)) + + do p = 1, phases%length + if(.not. myPlasticity(p)) cycle phase => phases%get(p) mech => phase%get('mechanics') - if(.not. myPlasticity(p)) cycle - i = i + 1 + i = p associate(prm => param(i), & dot => dotState(i), & dlt => deltaState(i), & @@ -256,16 +254,16 @@ pure module subroutine kinehardening_LpAndItsTangent(Lp,dLp_dMp,Mp,ph,me) integer :: & i,k,l,m,n - real(pReal), dimension(param(phase_plasticInstance(ph))%sum_N_sl) :: & + real(pReal), dimension(param(ph)%sum_N_sl) :: & gdot_pos,gdot_neg, & dgdot_dtau_pos,dgdot_dtau_neg Lp = 0.0_pReal dLp_dMp = 0.0_pReal - associate(prm => param(phase_plasticInstance(ph))) + associate(prm => param(ph)) - call kinetics(Mp,phase_plasticInstance(ph),me,gdot_pos,gdot_neg,dgdot_dtau_pos,dgdot_dtau_neg) + call kinetics(Mp,ph,me,gdot_pos,gdot_neg,dgdot_dtau_pos,dgdot_dtau_neg) do i = 1, prm%sum_N_sl Lp = Lp + (gdot_pos(i)+gdot_neg(i))*prm%P(1:3,1:3,i) @@ -293,14 +291,14 @@ module subroutine plastic_kinehardening_dotState(Mp,ph,me) real(pReal) :: & sumGamma - real(pReal), dimension(param(phase_plasticInstance(ph))%sum_N_sl) :: & + real(pReal), dimension(param(ph)%sum_N_sl) :: & gdot_pos,gdot_neg - associate(prm => param(phase_plasticInstance(ph)), stt => state(phase_plasticInstance(ph)),& - dot => dotState(phase_plasticInstance(ph))) + associate(prm => param(ph), stt => state(ph),& + dot => dotState(ph)) - call kinetics(Mp,phase_plasticInstance(ph),me,gdot_pos,gdot_neg) + call kinetics(Mp,ph,me,gdot_pos,gdot_neg) dot%accshear(:,me) = abs(gdot_pos+gdot_neg) sumGamma = sum(stt%accshear(:,me)) @@ -326,32 +324,25 @@ end subroutine plastic_kinehardening_dotState !-------------------------------------------------------------------------------------------------- !> @brief Calculate (instantaneous) incremental change of microstructure. !-------------------------------------------------------------------------------------------------- -module subroutine plastic_kinehardening_deltaState(Mp,instance,me) +module subroutine plastic_kinehardening_deltaState(Mp,ph,me) real(pReal), dimension(3,3), intent(in) :: & Mp !< Mandel stress integer, intent(in) :: & - instance, & + ph, & me - real(pReal), dimension(param(instance)%sum_N_sl) :: & + real(pReal), dimension(param(ph)%sum_N_sl) :: & gdot_pos,gdot_neg, & sense - associate(prm => param(instance), stt => state(instance), dlt => deltaState(instance)) + associate(prm => param(ph), stt => state(ph), dlt => deltaState(ph)) - call kinetics(Mp,instance,me,gdot_pos,gdot_neg) - sense = merge(state(instance)%sense(:,me), & ! keep existing... + call kinetics(Mp,ph,me,gdot_pos,gdot_neg) + sense = merge(state(ph)%sense(:,me), & ! keep existing... sign(1.0_pReal,gdot_pos+gdot_neg), & ! ...or have a defined dEq0(gdot_pos+gdot_neg,1e-10_pReal)) ! current sense of shear direction -#ifdef DEBUG - if (debugConstitutive%extensive & - .and. (me == prm%of_debug .or. .not. debugConstitutive%selective)) then - print*, '======= kinehardening delta state =======' - print*, sense,state(instance)%sense(:,me) - endif -#endif !-------------------------------------------------------------------------------------------------- ! switch in sense me shear? @@ -373,14 +364,14 @@ end subroutine plastic_kinehardening_deltaState !-------------------------------------------------------------------------------------------------- !> @brief Write results to HDF5 output file. !-------------------------------------------------------------------------------------------------- -module subroutine plastic_kinehardening_results(instance,group) +module subroutine plastic_kinehardening_results(ph,group) - integer, intent(in) :: instance + integer, intent(in) :: ph character(len=*), intent(in) :: group integer :: o - associate(prm => param(instance), stt => state(instance)) + associate(prm => param(ph), stt => state(ph)) outputsLoop: do o = 1,size(prm%output) select case(trim(prm%output(o))) case('xi') @@ -415,28 +406,28 @@ end subroutine plastic_kinehardening_results ! NOTE: Against the common convention, the result (i.e. intent(out)) variables are the last to ! have the optional arguments at the end. !-------------------------------------------------------------------------------------------------- -pure subroutine kinetics(Mp,instance,me, & +pure subroutine kinetics(Mp,ph,me, & gdot_pos,gdot_neg,dgdot_dtau_pos,dgdot_dtau_neg) real(pReal), dimension(3,3), intent(in) :: & Mp !< Mandel stress integer, intent(in) :: & - instance, & + ph, & me - real(pReal), intent(out), dimension(param(instance)%sum_N_sl) :: & + real(pReal), intent(out), dimension(param(ph)%sum_N_sl) :: & gdot_pos, & gdot_neg - real(pReal), intent(out), optional, dimension(param(instance)%sum_N_sl) :: & + real(pReal), intent(out), optional, dimension(param(ph)%sum_N_sl) :: & dgdot_dtau_pos, & dgdot_dtau_neg - real(pReal), dimension(param(instance)%sum_N_sl) :: & + real(pReal), dimension(param(ph)%sum_N_sl) :: & tau_pos, & tau_neg integer :: i - associate(prm => param(instance), stt => state(instance)) + associate(prm => param(ph), stt => state(ph)) do i = 1, prm%sum_N_sl tau_pos(i) = math_tensordot(Mp,prm%nonSchmid_pos(1:3,1:3,i)) - stt%crss_back(i,me) diff --git a/src/phase_mechanical_plastic_phenopowerlaw.f90 b/src/phase_mechanical_plastic_phenopowerlaw.f90 index bea7ef06b..94214f14a 100644 --- a/src/phase_mechanical_plastic_phenopowerlaw.f90 +++ b/src/phase_mechanical_plastic_phenopowerlaw.f90 @@ -70,7 +70,6 @@ module function plastic_phenopowerlaw_init() result(myPlasticity) logical, dimension(:), allocatable :: myPlasticity integer :: & - Ninstances, & p, i, & Nconstituents, & sizeState, sizeDotState, & @@ -91,24 +90,22 @@ module function plastic_phenopowerlaw_init() result(myPlasticity) myPlasticity = plastic_active('phenopowerlaw') - Ninstances = count(myPlasticity) - if(Ninstances == 0) return + if(count(myPlasticity) == 0) return print'(/,a)', ' <<<+- phase:mechanical:plastic:phenopowerlaw init -+>>>' - print'(a,i0)', ' # phases: ',Ninstances; flush(IO_STDOUT) + print'(a,i0)', ' # phases: ',count(myPlasticity); flush(IO_STDOUT) - allocate(param(Ninstances)) - allocate(state(Ninstances)) - allocate(dotState(Ninstances)) - phases => config_material%get('phase') - i = 0 + allocate(param(phases%length)) + allocate(state(phases%length)) + allocate(dotState(phases%length)) + do p = 1, phases%length + if(.not. myPlasticity(p)) cycle phase => phases%get(p) mech => phase%get('mechanics') - if(.not. myPlasticity(p)) cycle - i = i + 1 + i = p associate(prm => param(i), & dot => dotState(i), & stt => state(i)) @@ -302,18 +299,18 @@ pure module subroutine phenopowerlaw_LpAndItsTangent(Lp,dLp_dMp,Mp,ph,me) integer :: & i,k,l,m,n - real(pReal), dimension(param(phase_plasticInstance(ph))%sum_N_sl) :: & + real(pReal), dimension(param(ph)%sum_N_sl) :: & gdot_slip_pos,gdot_slip_neg, & dgdot_dtauslip_pos,dgdot_dtauslip_neg - real(pReal), dimension(param(phase_plasticInstance(ph))%sum_N_tw) :: & + real(pReal), dimension(param(ph)%sum_N_tw) :: & gdot_twin,dgdot_dtautwin Lp = 0.0_pReal dLp_dMp = 0.0_pReal - associate(prm => param(phase_plasticInstance(ph))) + associate(prm => param(ph)) - call kinetics_slip(Mp,phase_plasticInstance(ph),me,gdot_slip_pos,gdot_slip_neg,dgdot_dtauslip_pos,dgdot_dtauslip_neg) + call kinetics_slip(Mp,ph,me,gdot_slip_pos,gdot_slip_neg,dgdot_dtauslip_pos,dgdot_dtauslip_neg) slipSystems: do i = 1, prm%sum_N_sl Lp = Lp + (gdot_slip_pos(i)+gdot_slip_neg(i))*prm%P_sl(1:3,1:3,i) forall (k=1:3,l=1:3,m=1:3,n=1:3) & @@ -322,7 +319,7 @@ pure module subroutine phenopowerlaw_LpAndItsTangent(Lp,dLp_dMp,Mp,ph,me) + dgdot_dtauslip_neg(i) * prm%P_sl(k,l,i) * prm%nonSchmid_neg(m,n,i) enddo slipSystems - call kinetics_twin(Mp,phase_plasticInstance(ph),me,gdot_twin,dgdot_dtautwin) + call kinetics_twin(Mp,ph,me,gdot_twin,dgdot_dtautwin) twinSystems: do i = 1, prm%sum_N_tw Lp = Lp + gdot_twin(i)*prm%P_tw(1:3,1:3,i) forall (k=1:3,l=1:3,m=1:3,n=1:3) & @@ -350,12 +347,12 @@ module subroutine phenopowerlaw_dotState(Mp,ph,me) c_SlipSlip,c_TwinSlip,c_TwinTwin, & xi_slip_sat_offset,& sumGamma,sumF - real(pReal), dimension(param(phase_plasticInstance(ph))%sum_N_sl) :: & + real(pReal), dimension(param(ph)%sum_N_sl) :: & left_SlipSlip,right_SlipSlip, & gdot_slip_pos,gdot_slip_neg - associate(prm => param(phase_plasticInstance(ph)), stt => state(phase_plasticInstance(ph)), & - dot => dotState(phase_plasticInstance(ph))) + associate(prm => param(ph), stt => state(ph), & + dot => dotState(ph)) sumGamma = sum(stt%gamma_slip(:,me)) sumF = sum(stt%gamma_twin(:,me)/prm%gamma_tw_char) @@ -375,9 +372,9 @@ module subroutine phenopowerlaw_dotState(Mp,ph,me) !-------------------------------------------------------------------------------------------------- ! shear rates - call kinetics_slip(Mp,phase_plasticInstance(ph),me,gdot_slip_pos,gdot_slip_neg) + call kinetics_slip(Mp,ph,me,gdot_slip_pos,gdot_slip_neg) dot%gamma_slip(:,me) = abs(gdot_slip_pos+gdot_slip_neg) - call kinetics_twin(Mp,phase_plasticInstance(ph),me,dot%gamma_twin(:,me)) + call kinetics_twin(Mp,ph,me,dot%gamma_twin(:,me)) !-------------------------------------------------------------------------------------------------- ! hardening @@ -395,14 +392,14 @@ end subroutine phenopowerlaw_dotState !-------------------------------------------------------------------------------------------------- !> @brief Write results to HDF5 output file. !-------------------------------------------------------------------------------------------------- -module subroutine plastic_phenopowerlaw_results(instance,group) +module subroutine plastic_phenopowerlaw_results(ph,group) - integer, intent(in) :: instance + integer, intent(in) :: ph character(len=*), intent(in) :: group integer :: o - associate(prm => param(instance), stt => state(instance)) + associate(prm => param(ph), stt => state(ph)) outputsLoop: do o = 1,size(prm%output) select case(trim(prm%output(o))) @@ -434,28 +431,28 @@ end subroutine plastic_phenopowerlaw_results ! NOTE: Against the common convention, the result (i.e. intent(out)) variables are the last to ! have the optional arguments at the end. !-------------------------------------------------------------------------------------------------- -pure subroutine kinetics_slip(Mp,instance,me, & +pure subroutine kinetics_slip(Mp,ph,me, & gdot_slip_pos,gdot_slip_neg,dgdot_dtau_slip_pos,dgdot_dtau_slip_neg) real(pReal), dimension(3,3), intent(in) :: & Mp !< Mandel stress integer, intent(in) :: & - instance, & + ph, & me - real(pReal), intent(out), dimension(param(instance)%sum_N_sl) :: & + real(pReal), intent(out), dimension(param(ph)%sum_N_sl) :: & gdot_slip_pos, & gdot_slip_neg - real(pReal), intent(out), optional, dimension(param(instance)%sum_N_sl) :: & + real(pReal), intent(out), optional, dimension(param(ph)%sum_N_sl) :: & dgdot_dtau_slip_pos, & dgdot_dtau_slip_neg - real(pReal), dimension(param(instance)%sum_N_sl) :: & + real(pReal), dimension(param(ph)%sum_N_sl) :: & tau_slip_pos, & tau_slip_neg integer :: i - associate(prm => param(instance), stt => state(instance)) + associate(prm => param(ph), stt => state(ph)) do i = 1, prm%sum_N_sl tau_slip_pos(i) = math_tensordot(Mp,prm%nonSchmid_pos(1:3,1:3,i)) @@ -503,25 +500,25 @@ end subroutine kinetics_slip ! NOTE: Against the common convention, the result (i.e. intent(out)) variables are the last to ! have the optional arguments at the end. !-------------------------------------------------------------------------------------------------- -pure subroutine kinetics_twin(Mp,instance,me,& +pure subroutine kinetics_twin(Mp,ph,me,& gdot_twin,dgdot_dtau_twin) real(pReal), dimension(3,3), intent(in) :: & Mp !< Mandel stress integer, intent(in) :: & - instance, & + ph, & me - real(pReal), dimension(param(instance)%sum_N_tw), intent(out) :: & + real(pReal), dimension(param(ph)%sum_N_tw), intent(out) :: & gdot_twin - real(pReal), dimension(param(instance)%sum_N_tw), intent(out), optional :: & + real(pReal), dimension(param(ph)%sum_N_tw), intent(out), optional :: & dgdot_dtau_twin - real(pReal), dimension(param(instance)%sum_N_tw) :: & + real(pReal), dimension(param(ph)%sum_N_tw) :: & tau_twin integer :: i - associate(prm => param(instance), stt => state(instance)) + associate(prm => param(ph), stt => state(ph)) do i = 1, prm%sum_N_tw tau_twin(i) = math_tensordot(Mp,prm%P_tw(1:3,1:3,i)) From 18971d7d8b54900fcca829cfa2253be4c2da27ce Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 14 Feb 2021 07:06:14 +0100 Subject: [PATCH 49/60] separation by instance does not add any value --- src/phase_mechanical.f90 | 22 ++-- src/phase_mechanical_eigen.f90 | 2 +- src/phase_mechanical_plastic.f90 | 12 +- ...phase_mechanical_plastic_dislotungsten.f90 | 63 +++++---- src/phase_mechanical_plastic_dislotwin.f90 | 122 +++++++++--------- src/phase_mechanical_plastic_isotropic.f90 | 39 +++--- src/phase_mechanical_plastic_nonlocal.f90 | 2 +- 7 files changed, 129 insertions(+), 133 deletions(-) diff --git a/src/phase_mechanical.f90 b/src/phase_mechanical.f90 index ae3967b26..394c3d3ba 100644 --- a/src/phase_mechanical.f90 +++ b/src/phase_mechanical.f90 @@ -60,7 +60,7 @@ submodule(phase) mechanical module subroutine plastic_init end subroutine plastic_init - module subroutine plastic_isotropic_LiAndItsTangent(Li,dLi_dMi,Mi,instance,me) + module subroutine plastic_isotropic_LiAndItsTangent(Li,dLi_dMi,Mi,ph,me) real(pReal), dimension(3,3), intent(out) :: & Li !< inleastic velocity gradient real(pReal), dimension(3,3,3,3), intent(out) :: & @@ -68,7 +68,7 @@ submodule(phase) mechanical real(pReal), dimension(3,3), intent(in) :: & Mi !< Mandel stress integer, intent(in) :: & - instance, & + ph, & me end subroutine plastic_isotropic_LiAndItsTangent @@ -130,8 +130,8 @@ submodule(phase) mechanical end subroutine plastic_LpAndItsTangents - module subroutine plastic_isotropic_results(instance,group) - integer, intent(in) :: instance + module subroutine plastic_isotropic_results(ph,group) + integer, intent(in) :: ph character(len=*), intent(in) :: group end subroutine plastic_isotropic_results @@ -145,13 +145,13 @@ submodule(phase) mechanical character(len=*), intent(in) :: group end subroutine plastic_kinehardening_results - module subroutine plastic_dislotwin_results(instance,group) - integer, intent(in) :: instance + module subroutine plastic_dislotwin_results(ph,group) + integer, intent(in) :: ph character(len=*), intent(in) :: group end subroutine plastic_dislotwin_results - module subroutine plastic_dislotungsten_results(instance,group) - integer, intent(in) :: instance + module subroutine plastic_dislotungsten_results(ph,group) + integer, intent(in) :: ph character(len=*), intent(in) :: group end subroutine plastic_dislotungsten_results @@ -403,7 +403,7 @@ module subroutine mechanical_results(group,ph) select case(phase_plasticity(ph)) case(PLASTICITY_ISOTROPIC_ID) - call plastic_isotropic_results(phase_plasticInstance(ph),group//'plastic/') + call plastic_isotropic_results(ph,group//'plastic/') case(PLASTICITY_PHENOPOWERLAW_ID) call plastic_phenopowerlaw_results(ph,group//'plastic/') @@ -412,10 +412,10 @@ module subroutine mechanical_results(group,ph) call plastic_kinehardening_results(ph,group//'plastic/') case(PLASTICITY_DISLOTWIN_ID) - call plastic_dislotwin_results(phase_plasticInstance(ph),group//'plastic/') + call plastic_dislotwin_results(ph,group//'plastic/') case(PLASTICITY_DISLOTUNGSTEN_ID) - call plastic_dislotungsten_results(phase_plasticInstance(ph),group//'plastic/') + call plastic_dislotungsten_results(ph,group//'plastic/') case(PLASTICITY_NONLOCAL_ID) call plastic_nonlocal_results(phase_plasticInstance(ph),group//'plastic/') diff --git a/src/phase_mechanical_eigen.f90 b/src/phase_mechanical_eigen.f90 index bee7dc2d2..ce974a6a6 100644 --- a/src/phase_mechanical_eigen.f90 +++ b/src/phase_mechanical_eigen.f90 @@ -180,7 +180,7 @@ module subroutine phase_LiAndItsTangents(Li, dLi_dS, dLi_dFi, & plasticType: select case (phase_plasticity(ph)) case (PLASTICITY_isotropic_ID) plasticType - call plastic_isotropic_LiAndItsTangent(my_Li, my_dLi_dS, S ,phase_plasticInstance(ph),me) + call plastic_isotropic_LiAndItsTangent(my_Li, my_dLi_dS, S ,ph,me) Li = Li + my_Li dLi_dS = dLi_dS + my_dLi_dS active = .true. diff --git a/src/phase_mechanical_plastic.f90 b/src/phase_mechanical_plastic.f90 index b08e27276..a13b5c73f 100644 --- a/src/phase_mechanical_plastic.f90 +++ b/src/phase_mechanical_plastic.f90 @@ -179,17 +179,17 @@ submodule(phase:mechanical) plastic el !< current element number end subroutine nonlocal_dotState - module subroutine dislotwin_dependentState(T,instance,me) + module subroutine dislotwin_dependentState(T,ph,me) integer, intent(in) :: & - instance, & + ph, & me real(pReal), intent(in) :: & T end subroutine dislotwin_dependentState - module subroutine dislotungsten_dependentState(instance,me) + module subroutine dislotungsten_dependentState(ph,me) integer, intent(in) :: & - instance, & + ph, & me end subroutine dislotungsten_dependentState @@ -374,10 +374,10 @@ module subroutine plastic_dependentState(co, ip, el) plasticType: select case (phase_plasticity(material_phaseAt(co,el))) case (PLASTICITY_DISLOTWIN_ID) plasticType - call dislotwin_dependentState(thermal_T(ph,me),instance,me) + call dislotwin_dependentState(thermal_T(ph,me),ph,me) case (PLASTICITY_DISLOTUNGSTEN_ID) plasticType - call dislotungsten_dependentState(instance,me) + call dislotungsten_dependentState(ph,me) case (PLASTICITY_NONLOCAL_ID) plasticType call nonlocal_dependentState(instance,me,ip,el) diff --git a/src/phase_mechanical_plastic_dislotungsten.f90 b/src/phase_mechanical_plastic_dislotungsten.f90 index 6eb1e4abe..81c4605ac 100644 --- a/src/phase_mechanical_plastic_dislotungsten.f90 +++ b/src/phase_mechanical_plastic_dislotungsten.f90 @@ -78,7 +78,6 @@ module function plastic_dislotungsten_init() result(myPlasticity) logical, dimension(:), allocatable :: myPlasticity integer :: & - Ninstances, & p, i, & Nconstituents, & sizeState, sizeDotState, & @@ -97,29 +96,29 @@ module function plastic_dislotungsten_init() result(myPlasticity) mech, & pl + myPlasticity = plastic_active('dislotungsten') - Ninstances = count(myPlasticity) - if(Ninstances == 0) return + if(count(myPlasticity) == 0) return print'(/,a)', ' <<<+- phase:mechanical:plastic:dislotungsten init -+>>>' - print'(a,i0)', ' # phases: ',Ninstances; flush(IO_STDOUT) - + print'(a,i0)', ' # phases: ',count(myPlasticity); flush(IO_STDOUT) print*, 'Cereceda et al., International Journal of Plasticity 78:242–256, 2016' print*, 'https://dx.doi.org/10.1016/j.ijplas.2015.09.002' - allocate(param(Ninstances)) - allocate(state(Ninstances)) - allocate(dotState(Ninstances)) - allocate(dependentState(Ninstances)) phases => config_material%get('phase') - i = 0 + allocate(param(phases%length)) + allocate(state(phases%length)) + allocate(dotState(phases%length)) + allocate(dependentState(phases%length)) + + do p = 1, phases%length + if(.not. myPlasticity(p)) cycle phase => phases%get(p) mech => phase%get('mechanics') - if(.not. myPlasticity(p)) cycle - i = i + 1 + i = p associate(prm => param(i), & dot => dotState(i), & stt => state(i), & @@ -290,16 +289,16 @@ pure module subroutine dislotungsten_LpAndItsTangent(Lp,dLp_dMp, & integer :: & i,k,l,m,n - real(pReal), dimension(param(phase_plasticInstance(ph))%sum_N_sl) :: & + real(pReal), dimension(param(ph)%sum_N_sl) :: & dot_gamma_pos,dot_gamma_neg, & ddot_gamma_dtau_pos,ddot_gamma_dtau_neg Lp = 0.0_pReal dLp_dMp = 0.0_pReal - associate(prm => param(phase_plasticInstance(ph))) + associate(prm => param(ph)) - call kinetics(Mp,T,phase_plasticInstance(ph),me,dot_gamma_pos,dot_gamma_neg,ddot_gamma_dtau_pos,ddot_gamma_dtau_neg) + call kinetics(Mp,T,ph,me,dot_gamma_pos,dot_gamma_neg,ddot_gamma_dtau_pos,ddot_gamma_dtau_neg) do i = 1, prm%sum_N_sl Lp = Lp + (dot_gamma_pos(i)+dot_gamma_neg(i))*prm%P_sl(1:3,1:3,i) forall (k=1:3,l=1:3,m=1:3,n=1:3) & @@ -328,7 +327,7 @@ module subroutine dislotungsten_dotState(Mp,T,ph,me) real(pReal) :: & VacancyDiffusion - real(pReal), dimension(param(phase_plasticInstance(ph))%sum_N_sl) :: & + real(pReal), dimension(param(ph)%sum_N_sl) :: & gdot_pos, gdot_neg,& tau_pos,& tau_neg, & @@ -337,10 +336,10 @@ module subroutine dislotungsten_dotState(Mp,T,ph,me) dot_rho_dip_climb, & dip_distance - associate(prm => param(phase_plasticInstance(ph)), stt => state(phase_plasticInstance(ph)),& - dot => dotState(phase_plasticInstance(ph)), dst => dependentState(phase_plasticInstance(ph))) + associate(prm => param(ph), stt => state(ph),& + dot => dotState(ph), dst => dependentState(ph)) - call kinetics(Mp,T,phase_plasticInstance(ph),me,& + call kinetics(Mp,T,ph,me,& gdot_pos,gdot_neg, & tau_pos_out = tau_pos,tau_neg_out = tau_neg) @@ -377,16 +376,16 @@ end subroutine dislotungsten_dotState !-------------------------------------------------------------------------------------------------- !> @brief Calculate derived quantities from state. !-------------------------------------------------------------------------------------------------- -module subroutine dislotungsten_dependentState(instance,me) +module subroutine dislotungsten_dependentState(ph,me) integer, intent(in) :: & - instance, & + ph, & me - real(pReal), dimension(param(instance)%sum_N_sl) :: & + real(pReal), dimension(param(ph)%sum_N_sl) :: & dislocationSpacing - associate(prm => param(instance), stt => state(instance),dst => dependentState(instance)) + associate(prm => param(ph), stt => state(ph),dst => dependentState(ph)) dislocationSpacing = sqrt(matmul(prm%forestProjection,stt%rho_mob(:,me)+stt%rho_dip(:,me))) dst%threshold_stress(:,me) = prm%mu*prm%b_sl & @@ -402,14 +401,14 @@ end subroutine dislotungsten_dependentState !-------------------------------------------------------------------------------------------------- !> @brief Write results to HDF5 output file. !-------------------------------------------------------------------------------------------------- -module subroutine plastic_dislotungsten_results(instance,group) +module subroutine plastic_dislotungsten_results(ph,group) - integer, intent(in) :: instance + integer, intent(in) :: ph character(len=*), intent(in) :: group integer :: o - associate(prm => param(instance), stt => state(instance), dst => dependentState(instance)) + associate(prm => param(ph), stt => state(ph), dst => dependentState(ph)) outputsLoop: do o = 1,size(prm%output) select case(trim(prm%output(o))) case('rho_mob') @@ -441,7 +440,7 @@ end subroutine plastic_dislotungsten_results ! NOTE: Against the common convention, the result (i.e. intent(out)) variables are the last to ! have the optional arguments at the end !-------------------------------------------------------------------------------------------------- -pure subroutine kinetics(Mp,T,instance,me, & +pure subroutine kinetics(Mp,T,ph,me, & dot_gamma_pos,dot_gamma_neg,ddot_gamma_dtau_pos,ddot_gamma_dtau_neg,tau_pos_out,tau_neg_out) real(pReal), dimension(3,3), intent(in) :: & @@ -449,18 +448,18 @@ pure subroutine kinetics(Mp,T,instance,me, & real(pReal), intent(in) :: & T !< temperature integer, intent(in) :: & - instance, & + ph, & me - real(pReal), intent(out), dimension(param(instance)%sum_N_sl) :: & + real(pReal), intent(out), dimension(param(ph)%sum_N_sl) :: & dot_gamma_pos, & dot_gamma_neg - real(pReal), intent(out), optional, dimension(param(instance)%sum_N_sl) :: & + real(pReal), intent(out), optional, dimension(param(ph)%sum_N_sl) :: & ddot_gamma_dtau_pos, & ddot_gamma_dtau_neg, & tau_pos_out, & tau_neg_out - real(pReal), dimension(param(instance)%sum_N_sl) :: & + real(pReal), dimension(param(ph)%sum_N_sl) :: & StressRatio, & StressRatio_p,StressRatio_pminus1, & dvel, vel, & @@ -469,7 +468,7 @@ pure subroutine kinetics(Mp,T,instance,me, & needsGoodName ! ToDo: @Karo: any idea? integer :: j - associate(prm => param(instance), stt => state(instance), dst => dependentState(instance)) + associate(prm => param(ph), stt => state(ph), dst => dependentState(ph)) do j = 1, prm%sum_N_sl tau_pos(j) = math_tensordot(Mp,prm%nonSchmid_pos(1:3,1:3,j)) diff --git a/src/phase_mechanical_plastic_dislotwin.f90 b/src/phase_mechanical_plastic_dislotwin.f90 index ca385f417..3b33196d9 100644 --- a/src/phase_mechanical_plastic_dislotwin.f90 +++ b/src/phase_mechanical_plastic_dislotwin.f90 @@ -48,7 +48,7 @@ submodule(phase:plastic) dislotwin dot_N_0_tr, & !< trans nucleation rate [1/m³s] for each trans system t_tw, & !< twin thickness [m] for each twin system i_sl, & !< Adj. parameter for distance between 2 forest dislocations for each slip system - t_tr, & !< martensite lamellar thickness [m] for each trans system and instance + t_tr, & !< martensite lamellar thickness [m] for each trans system p, & !< p-exponent in glide velocity q, & !< q-exponent in glide velocity r, & !< r-exponent in twin nucleation rate @@ -126,7 +126,6 @@ module function plastic_dislotwin_init() result(myPlasticity) logical, dimension(:), allocatable :: myPlasticity integer :: & - Ninstances, & p, i, & Nconstituents, & sizeState, sizeDotState, & @@ -144,12 +143,12 @@ module function plastic_dislotwin_init() result(myPlasticity) mech, & pl + myPlasticity = plastic_active('dislotwin') - Ninstances = count(myPlasticity) - if(Ninstances == 0) return + if(count(myPlasticity) == 0) return print'(/,a)', ' <<<+- phase:mechanical:plastic:dislotwin init -+>>>' - print'(a,i0)', ' # phases: ',Ninstances; flush(IO_STDOUT) + print'(a,i0)', ' # phases: ',count(myPlasticity); flush(IO_STDOUT) print*, 'Ma and Roters, Acta Materialia 52(12):3603–3612, 2004' print*, 'https://doi.org/10.1016/j.actamat.2004.04.012'//IO_EOL @@ -160,18 +159,19 @@ module function plastic_dislotwin_init() result(myPlasticity) print*, 'Wong et al., Acta Materialia 118:140–151, 2016' print*, 'https://doi.org/10.1016/j.actamat.2016.07.032' - allocate(param(Ninstances)) - allocate(state(Ninstances)) - allocate(dotState(Ninstances)) - allocate(dependentState(Ninstances)) phases => config_material%get('phase') - i = 0 + allocate(param(phases%length)) + allocate(state(phases%length)) + allocate(dotState(phases%length)) + allocate(dependentState(phases%length)) + + do p = 1, phases%length + if(.not. myPlasticity(p)) cycle phase => phases%get(p) mech => phase%get('mechanics') - if(.not. myPlasticity(p)) cycle - i = i + 1 + i = p associate(prm => param(i), & dot => dotState(i), & stt => state(i), & @@ -496,8 +496,8 @@ module function plastic_dislotwin_homogenizedC(ph,me) result(homogenizedC) real(pReal) :: f_unrotated - associate(prm => param(phase_plasticInstance(ph)),& - stt => state(phase_plasticInstance(ph))) + associate(prm => param(ph),& + stt => state(ph)) f_unrotated = 1.0_pReal & - sum(stt%f_tw(1:prm%sum_N_tw,me)) & @@ -535,11 +535,11 @@ module subroutine dislotwin_LpAndItsTangent(Lp,dLp_dMp,Mp,T,ph,me) BoltzmannRatio, & ddot_gamma_dtau, & tau - real(pReal), dimension(param(phase_plasticInstance(ph))%sum_N_sl) :: & + real(pReal), dimension(param(ph)%sum_N_sl) :: & dot_gamma_sl,ddot_gamma_dtau_slip - real(pReal), dimension(param(phase_plasticInstance(ph))%sum_N_tw) :: & + real(pReal), dimension(param(ph)%sum_N_tw) :: & dot_gamma_twin,ddot_gamma_dtau_twin - real(pReal), dimension(param(phase_plasticInstance(ph))%sum_N_tr) :: & + real(pReal), dimension(param(ph)%sum_N_tr) :: & dot_gamma_tr,ddot_gamma_dtau_trans real(pReal):: dot_gamma_sb real(pReal), dimension(3,3) :: eigVectors, P_sb @@ -564,7 +564,7 @@ module subroutine dislotwin_LpAndItsTangent(Lp,dLp_dMp,Mp,T,ph,me) 0, 1, 1 & ],pReal),[ 3,6]) - associate(prm => param(phase_plasticInstance(ph)), stt => state(phase_plasticInstance(ph))) + associate(prm => param(ph), stt => state(ph)) f_unrotated = 1.0_pReal & - sum(stt%f_tw(1:prm%sum_N_tw,me)) & @@ -573,7 +573,7 @@ module subroutine dislotwin_LpAndItsTangent(Lp,dLp_dMp,Mp,T,ph,me) Lp = 0.0_pReal dLp_dMp = 0.0_pReal - call kinetics_slip(Mp,T,phase_plasticInstance(ph),me,dot_gamma_sl,ddot_gamma_dtau_slip) + call kinetics_slip(Mp,T,ph,me,dot_gamma_sl,ddot_gamma_dtau_slip) slipContribution: do i = 1, prm%sum_N_sl Lp = Lp + dot_gamma_sl(i)*prm%P_sl(1:3,1:3,i) forall (k=1:3,l=1:3,m=1:3,n=1:3) & @@ -581,7 +581,7 @@ module subroutine dislotwin_LpAndItsTangent(Lp,dLp_dMp,Mp,T,ph,me) + ddot_gamma_dtau_slip(i) * prm%P_sl(k,l,i) * prm%P_sl(m,n,i) enddo slipContribution - call kinetics_twin(Mp,T,dot_gamma_sl,phase_plasticInstance(ph),me,dot_gamma_twin,ddot_gamma_dtau_twin) + call kinetics_twin(Mp,T,dot_gamma_sl,ph,me,dot_gamma_twin,ddot_gamma_dtau_twin) twinContibution: do i = 1, prm%sum_N_tw Lp = Lp + dot_gamma_twin(i)*prm%P_tw(1:3,1:3,i) forall (k=1:3,l=1:3,m=1:3,n=1:3) & @@ -589,7 +589,7 @@ module subroutine dislotwin_LpAndItsTangent(Lp,dLp_dMp,Mp,T,ph,me) + ddot_gamma_dtau_twin(i)* prm%P_tw(k,l,i)*prm%P_tw(m,n,i) enddo twinContibution - call kinetics_trans(Mp,T,dot_gamma_sl,phase_plasticInstance(ph),me,dot_gamma_tr,ddot_gamma_dtau_trans) + call kinetics_trans(Mp,T,dot_gamma_sl,ph,me,dot_gamma_tr,ddot_gamma_dtau_trans) transContibution: do i = 1, prm%sum_N_tr Lp = Lp + dot_gamma_tr(i)*prm%P_tr(1:3,1:3,i) forall (k=1:3,l=1:3,m=1:3,n=1:3) & @@ -653,24 +653,24 @@ module subroutine dislotwin_dotState(Mp,T,ph,me) tau, & sigma_cl, & !< climb stress b_d !< ratio of Burgers vector to stacking fault width - real(pReal), dimension(param(phase_plasticInstance(ph))%sum_N_sl) :: & + real(pReal), dimension(param(ph)%sum_N_sl) :: & dot_rho_dip_formation, & dot_rho_dip_climb, & rho_dip_distance_min, & dot_gamma_sl - real(pReal), dimension(param(phase_plasticInstance(ph))%sum_N_tw) :: & + real(pReal), dimension(param(ph)%sum_N_tw) :: & dot_gamma_twin - real(pReal), dimension(param(phase_plasticInstance(ph))%sum_N_tr) :: & + real(pReal), dimension(param(ph)%sum_N_tr) :: & dot_gamma_tr - associate(prm => param(phase_plasticInstance(ph)), stt => state(phase_plasticInstance(ph)), & - dot => dotState(phase_plasticInstance(ph)), dst => dependentState(phase_plasticInstance(ph))) + associate(prm => param(ph), stt => state(ph), & + dot => dotState(ph), dst => dependentState(ph)) f_unrotated = 1.0_pReal & - sum(stt%f_tw(1:prm%sum_N_tw,me)) & - sum(stt%f_tr(1:prm%sum_N_tr,me)) - call kinetics_slip(Mp,T,phase_plasticInstance(ph),me,dot_gamma_sl) + call kinetics_slip(Mp,T,ph,me,dot_gamma_sl) dot%gamma_sl(:,me) = abs(dot_gamma_sl) rho_dip_distance_min = prm%D_a*prm%b_sl @@ -721,10 +721,10 @@ module subroutine dislotwin_dotState(Mp,T,ph,me) - 2.0_pReal*rho_dip_distance_min/prm%b_sl * stt%rho_dip(:,me)*abs(dot_gamma_sl) & - dot_rho_dip_climb - call kinetics_twin(Mp,T,dot_gamma_sl,phase_plasticInstance(ph),me,dot_gamma_twin) + call kinetics_twin(Mp,T,dot_gamma_sl,ph,me,dot_gamma_twin) dot%f_tw(:,me) = f_unrotated*dot_gamma_twin/prm%gamma_char - call kinetics_trans(Mp,T,dot_gamma_sl,phase_plasticInstance(ph),me,dot_gamma_tr) + call kinetics_trans(Mp,T,dot_gamma_sl,ph,me,dot_gamma_tr) dot%f_tr(:,me) = f_unrotated*dot_gamma_tr end associate @@ -735,33 +735,33 @@ end subroutine dislotwin_dotState !-------------------------------------------------------------------------------------------------- !> @brief Calculate derived quantities from state. !-------------------------------------------------------------------------------------------------- -module subroutine dislotwin_dependentState(T,instance,me) +module subroutine dislotwin_dependentState(T,ph,me) integer, intent(in) :: & - instance, & + ph, & me real(pReal), intent(in) :: & T real(pReal) :: & sumf_twin,Gamma,sumf_trans - real(pReal), dimension(param(instance)%sum_N_sl) :: & + real(pReal), dimension(param(ph)%sum_N_sl) :: & inv_lambda_sl_sl, & !< 1/mean free distance between 2 forest dislocations seen by a moving dislocation inv_lambda_sl_tw, & !< 1/mean free distance between 2 twin stacks from different systems seen by a moving dislocation inv_lambda_sl_tr !< 1/mean free distance between 2 martensite lamellar from different systems seen by a moving dislocation - real(pReal), dimension(param(instance)%sum_N_tw) :: & + real(pReal), dimension(param(ph)%sum_N_tw) :: & inv_lambda_tw_tw, & !< 1/mean free distance between 2 twin stacks from different systems seen by a growing twin f_over_t_tw - real(pReal), dimension(param(instance)%sum_N_tr) :: & + real(pReal), dimension(param(ph)%sum_N_tr) :: & inv_lambda_tr_tr, & !< 1/mean free distance between 2 martensite stacks from different systems seen by a growing martensite f_over_t_tr real(pReal), dimension(:), allocatable :: & x0 - associate(prm => param(instance),& - stt => state(instance),& - dst => dependentState(instance)) + associate(prm => param(ph),& + stt => state(ph),& + dst => dependentState(ph)) sumf_twin = sum(stt%f_tw(1:prm%sum_N_tw,me)) sumf_trans = sum(stt%f_tr(1:prm%sum_N_tr,me)) @@ -827,14 +827,14 @@ end subroutine dislotwin_dependentState !-------------------------------------------------------------------------------------------------- !> @brief Write results to HDF5 output file. !-------------------------------------------------------------------------------------------------- -module subroutine plastic_dislotwin_results(instance,group) +module subroutine plastic_dislotwin_results(ph,group) - integer, intent(in) :: instance + integer, intent(in) :: ph character(len=*), intent(in) :: group integer :: o - associate(prm => param(instance), stt => state(instance), dst => dependentState(instance)) + associate(prm => param(ph), stt => state(ph), dst => dependentState(ph)) outputsLoop: do o = 1,size(prm%output) select case(trim(prm%output(o))) @@ -882,7 +882,7 @@ end subroutine plastic_dislotwin_results ! NOTE: Against the common convention, the result (i.e. intent(out)) variables are the last to ! have the optional arguments at the end !-------------------------------------------------------------------------------------------------- -pure subroutine kinetics_slip(Mp,T,instance,me, & +pure subroutine kinetics_slip(Mp,T,ph,me, & dot_gamma_sl,ddot_gamma_dtau_slip,tau_slip) real(pReal), dimension(3,3), intent(in) :: & @@ -890,18 +890,18 @@ pure subroutine kinetics_slip(Mp,T,instance,me, & real(pReal), intent(in) :: & T !< temperature integer, intent(in) :: & - instance, & + ph, & me - real(pReal), dimension(param(instance)%sum_N_sl), intent(out) :: & + real(pReal), dimension(param(ph)%sum_N_sl), intent(out) :: & dot_gamma_sl - real(pReal), dimension(param(instance)%sum_N_sl), optional, intent(out) :: & + real(pReal), dimension(param(ph)%sum_N_sl), optional, intent(out) :: & ddot_gamma_dtau_slip, & tau_slip - real(pReal), dimension(param(instance)%sum_N_sl) :: & + real(pReal), dimension(param(ph)%sum_N_sl) :: & ddot_gamma_dtau - real(pReal), dimension(param(instance)%sum_N_sl) :: & + real(pReal), dimension(param(ph)%sum_N_sl) :: & tau, & stressRatio, & StressRatio_p, & @@ -914,7 +914,7 @@ pure subroutine kinetics_slip(Mp,T,instance,me, & tau_eff !< effective resolved stress integer :: i - associate(prm => param(instance), stt => state(instance), dst => dependentState(instance)) + associate(prm => param(ph), stt => state(ph), dst => dependentState(ph)) do i = 1, prm%sum_N_sl tau(i) = math_tensordot(Mp,prm%P_sl(1:3,1:3,i)) @@ -959,7 +959,7 @@ end subroutine kinetics_slip ! NOTE: Against the common convention, the result (i.e. intent(out)) variables are the last to ! have the optional arguments at the end. !-------------------------------------------------------------------------------------------------- -pure subroutine kinetics_twin(Mp,T,dot_gamma_sl,instance,me,& +pure subroutine kinetics_twin(Mp,T,dot_gamma_sl,ph,me,& dot_gamma_twin,ddot_gamma_dtau_twin) real(pReal), dimension(3,3), intent(in) :: & @@ -967,17 +967,17 @@ pure subroutine kinetics_twin(Mp,T,dot_gamma_sl,instance,me,& real(pReal), intent(in) :: & T !< temperature integer, intent(in) :: & - instance, & + ph, & me - real(pReal), dimension(param(instance)%sum_N_sl), intent(in) :: & + real(pReal), dimension(param(ph)%sum_N_sl), intent(in) :: & dot_gamma_sl - real(pReal), dimension(param(instance)%sum_N_tw), intent(out) :: & + real(pReal), dimension(param(ph)%sum_N_tw), intent(out) :: & dot_gamma_twin - real(pReal), dimension(param(instance)%sum_N_tw), optional, intent(out) :: & + real(pReal), dimension(param(ph)%sum_N_tw), optional, intent(out) :: & ddot_gamma_dtau_twin - real, dimension(param(instance)%sum_N_tw) :: & + real, dimension(param(ph)%sum_N_tw) :: & tau, & Ndot0, & stressRatio_r, & @@ -985,7 +985,7 @@ pure subroutine kinetics_twin(Mp,T,dot_gamma_sl,instance,me,& integer :: i,s1,s2 - associate(prm => param(instance), stt => state(instance), dst => dependentState(instance)) + associate(prm => param(ph), stt => state(ph), dst => dependentState(ph)) do i = 1, prm%sum_N_tw tau(i) = math_tensordot(Mp,prm%P_tw(1:3,1:3,i)) @@ -1028,7 +1028,7 @@ end subroutine kinetics_twin ! NOTE: Against the common convention, the result (i.e. intent(out)) variables are the last to ! have the optional arguments at the end. !-------------------------------------------------------------------------------------------------- -pure subroutine kinetics_trans(Mp,T,dot_gamma_sl,instance,me,& +pure subroutine kinetics_trans(Mp,T,dot_gamma_sl,ph,me,& dot_gamma_tr,ddot_gamma_dtau_trans) real(pReal), dimension(3,3), intent(in) :: & @@ -1036,24 +1036,24 @@ pure subroutine kinetics_trans(Mp,T,dot_gamma_sl,instance,me,& real(pReal), intent(in) :: & T !< temperature integer, intent(in) :: & - instance, & + ph, & me - real(pReal), dimension(param(instance)%sum_N_sl), intent(in) :: & + real(pReal), dimension(param(ph)%sum_N_sl), intent(in) :: & dot_gamma_sl - real(pReal), dimension(param(instance)%sum_N_tr), intent(out) :: & + real(pReal), dimension(param(ph)%sum_N_tr), intent(out) :: & dot_gamma_tr - real(pReal), dimension(param(instance)%sum_N_tr), optional, intent(out) :: & + real(pReal), dimension(param(ph)%sum_N_tr), optional, intent(out) :: & ddot_gamma_dtau_trans - real, dimension(param(instance)%sum_N_tr) :: & + real, dimension(param(ph)%sum_N_tr) :: & tau, & Ndot0, & stressRatio_s, & ddot_gamma_dtau integer :: i,s1,s2 - associate(prm => param(instance), stt => state(instance), dst => dependentState(instance)) + associate(prm => param(ph), stt => state(ph), dst => dependentState(ph)) do i = 1, prm%sum_N_tr tau(i) = math_tensordot(Mp,prm%P_tr(1:3,1:3,i)) diff --git a/src/phase_mechanical_plastic_isotropic.f90 b/src/phase_mechanical_plastic_isotropic.f90 index e315a38fb..39a4b3a7c 100644 --- a/src/phase_mechanical_plastic_isotropic.f90 +++ b/src/phase_mechanical_plastic_isotropic.f90 @@ -53,7 +53,6 @@ module function plastic_isotropic_init() result(myPlasticity) logical, dimension(:), allocatable :: myPlasticity integer :: & - Ninstances, & p, & i, & Nconstituents, & @@ -68,28 +67,26 @@ module function plastic_isotropic_init() result(myPlasticity) mech, & pl + myPlasticity = plastic_active('isotropic') - Ninstances = count(myPlasticity) - if(Ninstances == 0) return + if(count(myPlasticity) == 0) return print'(/,a)', ' <<<+- phase:mechanical:plastic:isotropic init -+>>>' - print'(a,i0)', ' # phses: ',Ninstances; flush(IO_STDOUT) - + print'(a,i0)', ' # phases: ',count(myPlasticity); flush(IO_STDOUT) print*, 'Maiti and Eisenlohr, Scripta Materialia 145:37–40, 2018' print*, 'https://doi.org/10.1016/j.scriptamat.2017.09.047' - allocate(param(Ninstances)) - allocate(state(Ninstances)) - allocate(dotState(Ninstances)) - phases => config_material%get('phase') - i = 0 + allocate(param(phases%length)) + allocate(state(phases%length)) + allocate(dotState(phases%length)) + do p = 1, phases%length + if(.not. myPlasticity(p)) cycle phase => phases%get(p) mech => phase%get('mechanics') - if(.not. myPlasticity(p)) cycle - i = i + 1 + i = p associate(prm => param(i), & dot => dotState(i), & stt => state(i)) @@ -191,7 +188,7 @@ module subroutine isotropic_LpAndItsTangent(Lp,dLp_dMp,Mp,ph,me) integer :: & k, l, m, n - associate(prm => param(phase_plasticInstance(ph)), stt => state(phase_plasticInstance(ph))) + associate(prm => param(ph), stt => state(ph)) Mp_dev = math_deviatoric33(Mp) squarenorm_Mp_dev = math_tensordot(Mp_dev,Mp_dev) @@ -221,7 +218,7 @@ end subroutine isotropic_LpAndItsTangent !-------------------------------------------------------------------------------------------------- !> @brief Calculate inelastic velocity gradient and its tangent. !-------------------------------------------------------------------------------------------------- -module subroutine plastic_isotropic_LiAndItsTangent(Li,dLi_dMi,Mi,instance,me) +module subroutine plastic_isotropic_LiAndItsTangent(Li,dLi_dMi,Mi,ph,me) real(pReal), dimension(3,3), intent(out) :: & Li !< inleastic velocity gradient @@ -231,7 +228,7 @@ module subroutine plastic_isotropic_LiAndItsTangent(Li,dLi_dMi,Mi,instance,me) real(pReal), dimension(3,3), intent(in) :: & Mi !< Mandel stress integer, intent(in) :: & - instance, & + ph, & me real(pReal) :: & @@ -239,7 +236,7 @@ module subroutine plastic_isotropic_LiAndItsTangent(Li,dLi_dMi,Mi,instance,me) integer :: & k, l, m, n - associate(prm => param(instance), stt => state(instance)) + associate(prm => param(ph), stt => state(ph)) tr=math_trace33(math_spherical33(Mi)) @@ -276,8 +273,8 @@ module subroutine isotropic_dotState(Mp,ph,me) xi_inf_star, & !< saturation xi norm_Mp !< norm of the (deviatoric) Mandel stress - associate(prm => param(phase_plasticInstance(ph)), stt => state(phase_plasticInstance(ph)), & - dot => dotState(phase_plasticInstance(ph))) + associate(prm => param(ph), stt => state(ph), & + dot => dotState(ph)) if (prm%dilatation) then norm_Mp = sqrt(math_tensordot(Mp,Mp)) @@ -313,14 +310,14 @@ end subroutine isotropic_dotState !-------------------------------------------------------------------------------------------------- !> @brief Write results to HDF5 output file. !-------------------------------------------------------------------------------------------------- -module subroutine plastic_isotropic_results(instance,group) +module subroutine plastic_isotropic_results(ph,group) - integer, intent(in) :: instance + integer, intent(in) :: ph character(len=*), intent(in) :: group integer :: o - associate(prm => param(instance), stt => state(instance)) + associate(prm => param(ph), stt => state(ph)) outputsLoop: do o = 1,size(prm%output) select case(trim(prm%output(o))) case ('xi') diff --git a/src/phase_mechanical_plastic_nonlocal.f90 b/src/phase_mechanical_plastic_nonlocal.f90 index 4e94f83ae..285217e1b 100644 --- a/src/phase_mechanical_plastic_nonlocal.f90 +++ b/src/phase_mechanical_plastic_nonlocal.f90 @@ -521,7 +521,7 @@ module function plastic_nonlocal_init() result(myPlasticity) if(.not. myPlasticity(p)) cycle i = i + 1 - Nconstituents = count(material_phaseAt==p) * discretization_nIPs + Nconstituents = count(material_phaseAt2 == p) l = 0 do t = 1,4 do s = 1,param(i)%sum_N_sl From 5a1ca012f8f0abb1d9ca1ff6a4bbdecde24145b3 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 14 Feb 2021 14:36:56 +0100 Subject: [PATCH 50/60] more suitable data structure no need to know (ip,el) at the constitutive level --- src/phase_mechanical_eigen.f90 | 1 - src/phase_mechanical_plastic_nonlocal.f90 | 38 +++++++++++++++++++++-- 2 files changed, 36 insertions(+), 3 deletions(-) diff --git a/src/phase_mechanical_eigen.f90 b/src/phase_mechanical_eigen.f90 index ce974a6a6..eb6d4f219 100644 --- a/src/phase_mechanical_eigen.f90 +++ b/src/phase_mechanical_eigen.f90 @@ -186,7 +186,6 @@ module subroutine phase_LiAndItsTangents(Li, dLi_dS, dLi_dFi, & active = .true. end select plasticType - KinematicsLoop: do k = 1, Nmodels(ph) kinematicsType: select case (model(k,ph)) case (KINEMATICS_thermal_expansion_ID) kinematicsType diff --git a/src/phase_mechanical_plastic_nonlocal.f90 b/src/phase_mechanical_plastic_nonlocal.f90 index 285217e1b..8f8e6cf3d 100644 --- a/src/phase_mechanical_plastic_nonlocal.f90 +++ b/src/phase_mechanical_plastic_nonlocal.f90 @@ -13,6 +13,12 @@ submodule(phase:plastic) nonlocal IPareaNormal => geometry_plastic_nonlocal_IPareaNormal0, & geometry_plastic_nonlocal_disable + type :: tGeometry + real(pReal), dimension(:), allocatable :: V_0 + end type tGeometry + + type(tGeometry), dimension(:), allocatable :: geom + real(pReal), parameter :: & kB = 1.38e-23_pReal !< Boltzmann constant in J/Kelvin @@ -203,6 +209,10 @@ module function plastic_nonlocal_init() result(myPlasticity) print*, 'Kords, Dissertation RWTH Aachen, 2014' print*, 'http://publications.rwth-aachen.de/record/229993' + + phases => config_material%get('phase') + allocate(geom(phases%length)) + allocate(param(Ninstances)) allocate(state(Ninstances)) allocate(state0(Ninstances)) @@ -210,7 +220,7 @@ module function plastic_nonlocal_init() result(myPlasticity) allocate(deltaState(Ninstances)) allocate(microstructure(Ninstances)) - phases => config_material%get('phase') + i = 0 do p = 1, phases%length phase => phases%get(p) @@ -225,7 +235,7 @@ module function plastic_nonlocal_init() result(myPlasticity) dst => microstructure(i)) pl => mech%get('plasticity') - phase_localPlasticity(p) = .not. pl%contains('nonlocal') + phase_localPlasticity(p) = .not. pl%contains('nonlocal') #if defined (__GFORTRAN__) prm%output = output_asStrings(pl) @@ -409,6 +419,9 @@ module function plastic_nonlocal_init() result(myPlasticity) call phase_allocateState(plasticState(p),Nconstituents,sizeState,sizeDotState,sizeDeltaState) + allocate(geom(p)%V_0(Nconstituents)) + call storeGeometry(p) + plasticState(p)%nonlocal = pl%get_asBool('nonlocal') if(plasticState(p)%nonlocal .and. .not. allocated(IPneighborhood)) & call IO_error(212,ext_msg='IPneighborhood does not exist') @@ -1831,4 +1844,25 @@ pure function getRho0(instance,me,ip,el) end function getRho0 + +subroutine storeGeometry(ph) + + integer, intent(in) :: ph + + integer :: ip, el, ce, co + + ce = 0 + do el = 1, size(material_homogenizationMemberAt,2) + do ip = 1, size(material_homogenizationMemberAt,1) + ce = ce + 1 + do co = 1, homogenization_maxNconstituents + if(material_phaseAt2(co,ce) == ph) then + geom(ph)%V_0(material_phaseMemberAt2(co,ce)) = IPvolume(ip,el) + endif + enddo + enddo + enddo + +end subroutine + end submodule nonlocal From 4026881e5a08204c2e117cd1bcb8e9eaf62f2954 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 14 Feb 2021 15:29:10 +0100 Subject: [PATCH 51/60] clean interface still need to get rid of internal converstion to instance and el,ip arguments --- src/phase.f90 | 6 +- src/phase_mechanical.f90 | 6 +- src/phase_mechanical_plastic.f90 | 12 +- src/phase_mechanical_plastic_nonlocal.f90 | 195 +++++++++++----------- 4 files changed, 107 insertions(+), 112 deletions(-) diff --git a/src/phase.f90 b/src/phase.f90 index f129ba92f..39d5cc340 100644 --- a/src/phase.f90 +++ b/src/phase.f90 @@ -247,9 +247,9 @@ module phase TDot end subroutine phase_thermal_getRate - module subroutine plastic_nonlocal_updateCompatibility(orientation,instance,i,e) + module subroutine plastic_nonlocal_updateCompatibility(orientation,ph,i,e) integer, intent(in) :: & - instance, & + ph, & i, & e type(rotation), dimension(1,discretization_nIPs,discretization_Nelems), intent(in) :: & @@ -616,7 +616,7 @@ subroutine crystallite_orientations(co,ip,el) if (plasticState(material_phaseAt(1,el))%nonlocal) & call plastic_nonlocal_updateCompatibility(crystallite_orientation, & - phase_plasticInstance(material_phaseAt(1,el)),ip,el) + material_phaseAt(1,el),ip,el) end subroutine crystallite_orientations diff --git a/src/phase_mechanical.f90 b/src/phase_mechanical.f90 index 394c3d3ba..824c1e257 100644 --- a/src/phase_mechanical.f90 +++ b/src/phase_mechanical.f90 @@ -155,8 +155,8 @@ submodule(phase) mechanical character(len=*), intent(in) :: group end subroutine plastic_dislotungsten_results - module subroutine plastic_nonlocal_results(instance,group) - integer, intent(in) :: instance + module subroutine plastic_nonlocal_results(ph,group) + integer, intent(in) :: ph character(len=*), intent(in) :: group end subroutine plastic_nonlocal_results @@ -418,7 +418,7 @@ module subroutine mechanical_results(group,ph) call plastic_dislotungsten_results(ph,group//'plastic/') case(PLASTICITY_NONLOCAL_ID) - call plastic_nonlocal_results(phase_plasticInstance(ph),group//'plastic/') + call plastic_nonlocal_results(ph,group//'plastic/') end select diff --git a/src/phase_mechanical_plastic.f90 b/src/phase_mechanical_plastic.f90 index a13b5c73f..cf9faf6c9 100644 --- a/src/phase_mechanical_plastic.f90 +++ b/src/phase_mechanical_plastic.f90 @@ -193,9 +193,9 @@ submodule(phase:mechanical) plastic me end subroutine dislotungsten_dependentState - module subroutine nonlocal_dependentState(instance, me, ip, el) + module subroutine nonlocal_dependentState(ph, me, ip, el) integer, intent(in) :: & - instance, & + ph, & me, & ip, & !< current integration point el !< current element number @@ -209,11 +209,11 @@ submodule(phase:mechanical) plastic me end subroutine plastic_kinehardening_deltaState - module subroutine plastic_nonlocal_deltaState(Mp,instance,me,ip,el) + module subroutine plastic_nonlocal_deltaState(Mp,ph,me,ip,el) real(pReal), dimension(3,3), intent(in) :: & Mp integer, intent(in) :: & - instance, & + ph, & me, & ip, & el @@ -380,7 +380,7 @@ module subroutine plastic_dependentState(co, ip, el) call dislotungsten_dependentState(ph,me) case (PLASTICITY_NONLOCAL_ID) plasticType - call nonlocal_dependentState(instance,me,ip,el) + call nonlocal_dependentState(ph,me,ip,el) end select plasticType @@ -421,7 +421,7 @@ module function plastic_deltaState(co, ip, el, ph, me) result(broken) broken = any(IEEE_is_NaN(plasticState(ph)%deltaState(:,me))) case (PLASTICITY_NONLOCAL_ID) plasticType - call plastic_nonlocal_deltaState(Mp,instance,me,ip,el) + call plastic_nonlocal_deltaState(Mp,ph,me,ip,el) broken = any(IEEE_is_NaN(plasticState(ph)%deltaState(:,me))) case default diff --git a/src/phase_mechanical_plastic_nonlocal.f90 b/src/phase_mechanical_plastic_nonlocal.f90 index 8f8e6cf3d..1f6fce029 100644 --- a/src/phase_mechanical_plastic_nonlocal.f90 +++ b/src/phase_mechanical_plastic_nonlocal.f90 @@ -12,6 +12,8 @@ submodule(phase:plastic) nonlocal IParea => geometry_plastic_nonlocal_IParea0, & IPareaNormal => geometry_plastic_nonlocal_IPareaNormal0, & geometry_plastic_nonlocal_disable + use phase, & + ins => phase_plasticInstance type :: tGeometry real(pReal), dimension(:), allocatable :: V_0 @@ -160,7 +162,7 @@ submodule(phase:plastic) nonlocal state, & state0 - type(tParameters), dimension(:), allocatable :: param !< containers of constitutive parameters (len Ninstances) + type(tParameters), dimension(:), allocatable :: param !< containers of constitutive parameters type(tNonlocalMicrostructure), dimension(:), allocatable :: microstructure @@ -510,7 +512,7 @@ module function plastic_nonlocal_init() result(myPlasticity) allocate(dst%tau_back(prm%sum_N_sl,Nconstituents),source=0.0_pReal) end associate - if (Nconstituents > 0) call stateInit(ini,p,Nconstituents,i) + if (Nconstituents > 0) call stateInit(ini,p,Nconstituents) plasticState(p)%state0 = plasticState(p)%state !-------------------------------------------------------------------------------------------------- @@ -565,10 +567,10 @@ end function plastic_nonlocal_init !-------------------------------------------------------------------------------------------------- !> @brief calculates quantities characterizing the microstructure !-------------------------------------------------------------------------------------------------- -module subroutine nonlocal_dependentState(instance, me, ip, el) +module subroutine nonlocal_dependentState(ph, me, ip, el) integer, intent(in) :: & - instance, & + ph, & me, & ip, & el @@ -602,29 +604,29 @@ module subroutine nonlocal_dependentState(instance, me, ip, el) invConnections real(pReal), dimension(3,nIPneighbors) :: & connection_latticeConf - real(pReal), dimension(2,param(instance)%sum_N_sl) :: & + real(pReal), dimension(2,param(ins(ph))%sum_N_sl) :: & rhoExcess - real(pReal), dimension(param(instance)%sum_N_sl) :: & + real(pReal), dimension(param(ins(ph))%sum_N_sl) :: & rho_edg_delta, & rho_scr_delta - real(pReal), dimension(param(instance)%sum_N_sl,10) :: & + real(pReal), dimension(param(ins(ph))%sum_N_sl,10) :: & rho, & rho0, & rho_neighbor0 - real(pReal), dimension(param(instance)%sum_N_sl,param(instance)%sum_N_sl) :: & + real(pReal), dimension(param(ins(ph))%sum_N_sl,param(ins(ph))%sum_N_sl) :: & myInteractionMatrix ! corrected slip interaction matrix - real(pReal), dimension(param(instance)%sum_N_sl,nIPneighbors) :: & + real(pReal), dimension(param(ins(ph))%sum_N_sl,nIPneighbors) :: & rho_edg_delta_neighbor, & rho_scr_delta_neighbor real(pReal), dimension(2,maxval(param%sum_N_sl),nIPneighbors) :: & neighbor_rhoExcess, & ! excess density at neighboring material point neighbor_rhoTotal ! total density at neighboring material point - real(pReal), dimension(3,param(instance)%sum_N_sl,2) :: & + real(pReal), dimension(3,param(ins(ph))%sum_N_sl,2) :: & m ! direction of dislocation motion - associate(prm => param(instance),dst => microstructure(instance), stt => state(instance)) + associate(prm => param(ins(ph)),dst => microstructure(ins(ph)), stt => state(ins(ph))) - rho = getRho(instance,me,ip,el) + rho = getRho(ph,me,ip,el) stt%rho_forest(:,me) = matmul(prm%forestProjection_Edge, sum(abs(rho(:,edg)),2)) & + matmul(prm%forestProjection_Screw,sum(abs(rho(:,scr)),2)) @@ -652,9 +654,8 @@ module subroutine nonlocal_dependentState(instance, me, ip, el) ! ToDo: MD: this is most likely only correct for F_i = I !################################################################################################# - rho0 = getRho0(instance,me,ip,el) + rho0 = getRho0(ph,me,ip,el) if (.not. phase_localPlasticity(material_phaseAt(1,el)) .and. prm%shortRangeStressCorrection) then - ph = material_phaseAt(1,el) invFp = math_inv33(phase_mechanical_Fp(ph)%data(1:3,1:3,me)) invFe = math_inv33(phase_mechanical_Fe(ph)%data(1:3,1:3,me)) @@ -675,11 +676,11 @@ module subroutine nonlocal_dependentState(instance, me, ip, el) neighbor_ip = IPneighborhood(2,n,ip,el) no = material_phasememberAt(1,neighbor_ip,neighbor_el) if (neighbor_el > 0 .and. neighbor_ip > 0) then - neighbor_instance = phase_plasticInstance(material_phaseAt(1,neighbor_el)) - if (neighbor_instance == instance) then + neighbor_instance = ins(material_phaseAt(1,neighbor_el)) + if (neighbor_instance == ins(ph)) then nRealNeighbors = nRealNeighbors + 1.0_pReal - rho_neighbor0 = getRho0(instance,no,neighbor_ip,neighbor_el) + rho_neighbor0 = getRho0(ph,no,neighbor_ip,neighbor_el) rho_edg_delta_neighbor(:,n) = rho_neighbor0(:,mob_edg_pos) - rho_neighbor0(:,mob_edg_neg) rho_scr_delta_neighbor(:,n) = rho_neighbor0(:,mob_scr_pos) - rho_neighbor0(:,mob_scr_neg) @@ -795,25 +796,25 @@ module subroutine nonlocal_LpAndItsTangent(Lp,dLp_dMp, & l, & t, & !< dislocation type s !< index of my current slip system - real(pReal), dimension(param(phase_plasticInstance(ph))%sum_N_sl,8) :: & + real(pReal), dimension(param(ins(ph))%sum_N_sl,8) :: & rhoSgl !< single dislocation densities (including blocked) - real(pReal), dimension(param(phase_plasticInstance(ph))%sum_N_sl,10) :: & + real(pReal), dimension(param(ins(ph))%sum_N_sl,10) :: & rho - real(pReal), dimension(param(phase_plasticInstance(ph))%sum_N_sl,4) :: & + real(pReal), dimension(param(ins(ph))%sum_N_sl,4) :: & v, & !< velocity tauNS, & !< resolved shear stress including non Schmid and backstress terms dv_dtau, & !< velocity derivative with respect to the shear stress dv_dtauNS !< velocity derivative with respect to the shear stress - real(pReal), dimension(param(phase_plasticInstance(ph))%sum_N_sl) :: & + real(pReal), dimension(param(ins(ph))%sum_N_sl) :: & tau, & !< resolved shear stress including backstress terms gdotTotal !< shear rate - associate(prm => param(phase_plasticInstance(ph)),dst=>microstructure(phase_plasticInstance(ph)),& - stt=>state(phase_plasticInstance(ph))) + associate(prm => param(ins(ph)),dst=>microstructure(ins(ph)),& + stt=>state(ins(ph))) ns = prm%sum_N_sl !*** shortcut to state variables - rho = getRho(phase_plasticInstance(ph),me,ip,el) + rho = getRho(ph,me,ip,el) rhoSgl = rho(:,sgl) do s = 1,ns @@ -833,7 +834,7 @@ module subroutine nonlocal_LpAndItsTangent(Lp,dLp_dMp, & ! edges call kinetics(v(:,1), dv_dtau(:,1), dv_dtauNS(:,1), & - tau, tauNS(:,1), dst%tau_pass(:,me),1,Temperature, phase_plasticInstance(ph)) + tau, tauNS(:,1), dst%tau_pass(:,me),1,Temperature, ph) v(:,2) = v(:,1) dv_dtau(:,2) = dv_dtau(:,1) dv_dtauNS(:,2) = dv_dtauNS(:,1) @@ -846,7 +847,7 @@ module subroutine nonlocal_LpAndItsTangent(Lp,dLp_dMp, & else do t = 3,4 call kinetics(v(:,t), dv_dtau(:,t), dv_dtauNS(:,t), & - tau, tauNS(:,t), dst%tau_pass(:,me),2,Temperature, phase_plasticInstance(ph)) + tau, tauNS(:,t), dst%tau_pass(:,me),2,Temperature, ph) enddo endif @@ -879,12 +880,12 @@ end subroutine nonlocal_LpAndItsTangent !-------------------------------------------------------------------------------------------------- !> @brief (instantaneous) incremental change of microstructure !-------------------------------------------------------------------------------------------------- -module subroutine plastic_nonlocal_deltaState(Mp,instance,me,ip,el) +module subroutine plastic_nonlocal_deltaState(Mp,ph,me,ip,el) real(pReal), dimension(3,3), intent(in) :: & Mp !< MandelStress integer, intent(in) :: & - instance, & ! current instance of this plasticity + ph, & me, & !< offset ip, & el @@ -895,31 +896,29 @@ module subroutine plastic_nonlocal_deltaState(Mp,instance,me,ip,el) c, & ! character of dislocation t, & ! type of dislocation s ! index of my current slip system - real(pReal), dimension(param(instance)%sum_N_sl,10) :: & + real(pReal), dimension(param(ins(ph))%sum_N_sl,10) :: & deltaRhoRemobilization, & ! density increment by remobilization deltaRhoDipole2SingleStress ! density increment by dipole dissociation (by stress change) - real(pReal), dimension(param(instance)%sum_N_sl,10) :: & + real(pReal), dimension(param(ins(ph))%sum_N_sl,10) :: & rho ! current dislocation densities - real(pReal), dimension(param(instance)%sum_N_sl,4) :: & + real(pReal), dimension(param(ins(ph))%sum_N_sl,4) :: & v ! dislocation glide velocity - real(pReal), dimension(param(instance)%sum_N_sl) :: & + real(pReal), dimension(param(ins(ph))%sum_N_sl) :: & tau ! current resolved shear stress - real(pReal), dimension(param(instance)%sum_N_sl,2) :: & + real(pReal), dimension(param(ins(ph))%sum_N_sl,2) :: & rhoDip, & ! current dipole dislocation densities (screw and edge dipoles) dUpper, & ! current maximum stable dipole distance for edges and screws dUpperOld, & ! old maximum stable dipole distance for edges and screws deltaDUpper ! change in maximum stable dipole distance for edges and screws - ph = material_phaseAt(1,el) - - associate(prm => param(instance),dst => microstructure(instance),del => deltaState(instance)) - ns = prm%sum_N_sl + associate(prm => param(ins(ph)),dst => microstructure(ins(ph)),del => deltaState(ins(ph))) + ns = prm%sum_N_sl !*** shortcut to state variables - forall (s = 1:ns, t = 1:4) v(s,t) = plasticState(ph)%state(iV(s,t,instance),me) - forall (s = 1:ns, c = 1:2) dUpperOld(s,c) = plasticState(ph)%state(iD(s,c,instance),me) + forall (s = 1:ns, t = 1:4) v(s,t) = plasticState(ph)%state(iV(s,t,ins(ph)),me) + forall (s = 1:ns, c = 1:2) dUpperOld(s,c) = plasticState(ph)%state(iD(s,c,ins(ph)),me) - rho = getRho(instance,me,ip,el) + rho = getRho(ph,me,ip,el) rhoDip = rho(:,dip) !**************************************************************************** @@ -964,7 +963,7 @@ module subroutine plastic_nonlocal_deltaState(Mp,instance,me,ip,el) / (dUpperOld(s,c) - prm%minDipoleHeight(s,c)) forall (t=1:4) deltaRhoDipole2SingleStress(:,t) = -0.5_pReal * deltaRhoDipole2SingleStress(:,(t-1)/2+9) - forall (s = 1:ns, c = 1:2) plasticState(ph)%state(iD(s,c,instance),me) = dUpper(s,c) + forall (s = 1:ns, c = 1:2) plasticState(ph)%state(iD(s,c,ins(ph)),me) = dUpper(s,c) plasticState(ph)%deltaState(:,me) = 0.0_pReal del%rho(:,me) = reshape(deltaRhoRemobilization + deltaRhoDipole2SingleStress, [10*ns]) @@ -1005,7 +1004,7 @@ module subroutine nonlocal_dotState(Mp, Temperature,timestep, & c, & !< character of dislocation t, & !< type of dislocation s !< index of my current slip system - real(pReal), dimension(param(phase_plasticInstance(ph))%sum_N_sl,10) :: & + real(pReal), dimension(param(ins(ph))%sum_N_sl,10) :: & rho, & rho0, & !< dislocation density at beginning of time step rhoDot, & !< density evolution @@ -1013,17 +1012,17 @@ module subroutine nonlocal_dotState(Mp, Temperature,timestep, & rhoDotSingle2DipoleGlide, & !< density evolution by dipole formation (by glide) rhoDotAthermalAnnihilation, & !< density evolution by athermal annihilation rhoDotThermalAnnihilation !< density evolution by thermal annihilation - real(pReal), dimension(param(phase_plasticInstance(ph))%sum_N_sl,8) :: & + real(pReal), dimension(param(ins(ph))%sum_N_sl,8) :: & rhoSgl, & !< current single dislocation densities (positive/negative screw and edge without dipoles) my_rhoSgl0 !< single dislocation densities of central ip (positive/negative screw and edge without dipoles) - real(pReal), dimension(param(phase_plasticInstance(ph))%sum_N_sl,4) :: & + real(pReal), dimension(param(ins(ph))%sum_N_sl,4) :: & v, & !< current dislocation glide velocity v0, & gdot !< shear rates - real(pReal), dimension(param(phase_plasticInstance(ph))%sum_N_sl) :: & + real(pReal), dimension(param(ins(ph))%sum_N_sl) :: & tau, & !< current resolved shear stress vClimb !< climb velocity of edge dipoles - real(pReal), dimension(param(phase_plasticInstance(ph))%sum_N_sl,2) :: & + real(pReal), dimension(param(ins(ph))%sum_N_sl,2) :: & rhoDip, & !< current dipole dislocation densities (screw and edge dipoles) dLower, & !< minimum stable dipole distance for edges and screws dUpper !< current maximum stable dipole distance for edges and screws @@ -1035,22 +1034,22 @@ module subroutine nonlocal_dotState(Mp, Temperature,timestep, & return endif - associate(prm => param(phase_plasticInstance(ph)), & - dst => microstructure(phase_plasticInstance(ph)), & - dot => dotState(phase_plasticInstance(ph)), & - stt => state(phase_plasticInstance(ph))) + associate(prm => param(ins(ph)), & + dst => microstructure(ins(ph)), & + dot => dotState(ins(ph)), & + stt => state(ins(ph))) ns = prm%sum_N_sl tau = 0.0_pReal gdot = 0.0_pReal - rho = getRho(phase_plasticInstance(ph),me,ip,el) + rho = getRho(ph,me,ip,el) rhoSgl = rho(:,sgl) rhoDip = rho(:,dip) - rho0 = getRho0(phase_plasticInstance(ph),me,ip,el) + rho0 = getRho0(ph,me,ip,el) my_rhoSgl0 = rho0(:,sgl) - forall (s = 1:ns, t = 1:4) v(s,t) = plasticState(ph)%state(iV(s,t,phase_plasticInstance(ph)),me) + forall (s = 1:ns, t = 1:4) v(s,t) = plasticState(ph)%state(iV(s,t,ins(ph)),me) gdot = rhoSgl(:,1:4) * v * spread(prm%b_sl,2,4) #ifdef DEBUG @@ -1099,7 +1098,7 @@ module subroutine nonlocal_dotState(Mp, Temperature,timestep, & * sqrt(stt%rho_forest(:,me)) / prm%i_sl / prm%b_sl, 2, 4) endif isBCC - forall (s = 1:ns, t = 1:4) v0(s,t) = plasticState(ph)%state0(iV(s,t,phase_plasticInstance(ph)),me) + forall (s = 1:ns, t = 1:4) v0(s,t) = plasticState(ph)%state0(iV(s,t,ins(ph)),me) !**************************************************************************** @@ -1155,7 +1154,7 @@ module subroutine nonlocal_dotState(Mp, Temperature,timestep, & - rhoDip(s,1) / timestep - rhoDotAthermalAnnihilation(s,9) & - rhoDotSingle2DipoleGlide(s,9)) ! make sure that we do not annihilate more dipoles than we have - rhoDot = rhoDotFlux(timestep, phase_plasticInstance(ph),me,ip,el) & + rhoDot = rhoDotFlux(timestep, ph,me,ip,el) & + rhoDotMultiplication & + rhoDotSingle2DipoleGlide & + rhoDotAthermalAnnihilation & @@ -1184,12 +1183,12 @@ end subroutine nonlocal_dotState !--------------------------------------------------------------------------------------------------- !> @brief calculates the rate of change of microstructure !--------------------------------------------------------------------------------------------------- -function rhoDotFlux(timestep,instance,me,ip,el) +function rhoDotFlux(timestep,ph,me,ip,el) real(pReal), intent(in) :: & timestep !< substepped crystallite time increment integer, intent(in) :: & - instance, & + ph, & me, & ip, & !< current integration point el !< current element number @@ -1212,20 +1211,20 @@ function rhoDotFlux(timestep,instance,me,ip,el) np,& !< neighbor phase shortcut topp, & !< type of dislocation with opposite sign to t s !< index of my current slip system - real(pReal), dimension(param(instance)%sum_N_sl,10) :: & + real(pReal), dimension(param(ins(ph))%sum_N_sl,10) :: & rho, & rho0, & !< dislocation density at beginning of time step rhoDotFlux !< density evolution by flux - real(pReal), dimension(param(instance)%sum_N_sl,8) :: & + real(pReal), dimension(param(ins(ph))%sum_N_sl,8) :: & rhoSgl, & !< current single dislocation densities (positive/negative screw and edge without dipoles) neighbor_rhoSgl0, & !< current single dislocation densities of neighboring ip (positive/negative screw and edge without dipoles) my_rhoSgl0 !< single dislocation densities of central ip (positive/negative screw and edge without dipoles) - real(pReal), dimension(param(instance)%sum_N_sl,4) :: & + real(pReal), dimension(param(ins(ph))%sum_N_sl,4) :: & v, & !< current dislocation glide velocity v0, & neighbor_v0, & !< dislocation glide velocity of enighboring ip gdot !< shear rates - real(pReal), dimension(3,param(instance)%sum_N_sl,4) :: & + real(pReal), dimension(3,param(ins(ph))%sum_N_sl,4) :: & m !< direction of dislocation motion real(pReal), dimension(3,3) :: & my_F, & !< my total deformation gradient @@ -1243,26 +1242,25 @@ function rhoDotFlux(timestep,instance,me,ip,el) transmissivity, & !< overall transmissivity of dislocation flux to neighboring material point lineLength !< dislocation line length leaving the current interface - ph = material_phaseAt(1,el) - associate(prm => param(instance), & - dst => microstructure(instance), & - dot => dotState(instance), & - stt => state(instance)) + associate(prm => param(ins(ph)), & + dst => microstructure(ins(ph)), & + dot => dotState(ins(ph)), & + stt => state(ins(ph))) ns = prm%sum_N_sl gdot = 0.0_pReal - rho = getRho(instance,me,ip,el) + rho = getRho(ph,me,ip,el) rhoSgl = rho(:,sgl) - rho0 = getRho0(instance,me,ip,el) + rho0 = getRho0(ph,me,ip,el) my_rhoSgl0 = rho0(:,sgl) - forall (s = 1:ns, t = 1:4) v(s,t) = plasticState(ph)%state(iV(s,t,instance),me) !ToDo: MD: I think we should use state0 here + forall (s = 1:ns, t = 1:4) v(s,t) = plasticState(ph)%state(iV(s,t,ins(ph)),me) !ToDo: MD: I think we should use state0 here gdot = rhoSgl(:,1:4) * v * spread(prm%b_sl,2,4) - forall (s = 1:ns, t = 1:4) v0(s,t) = plasticState(ph)%state0(iV(s,t,instance),me) + forall (s = 1:ns, t = 1:4) v0(s,t) = plasticState(ph)%state0(iV(s,t,ins(ph)),me) !**************************************************************************** !*** calculate dislocation fluxes (only for nonlocal plasticity) @@ -1314,7 +1312,7 @@ function rhoDotFlux(timestep,instance,me,ip,el) opposite_n = IPneighborhood(3,opposite_neighbor,ip,el) if (neighbor_n > 0) then ! if neighbor exists, average deformation gradient - neighbor_instance = phase_plasticInstance(material_phaseAt(1,neighbor_el)) + neighbor_instance = ins(material_phaseAt(1,neighbor_el)) neighbor_F = phase_mechanical_F(np)%data(1:3,1:3,no) neighbor_Fe = matmul(neighbor_F, math_inv33(phase_mechanical_Fp(np)%data(1:3,1:3,no))) Favg = 0.5_pReal * (my_F + neighbor_F) @@ -1421,12 +1419,12 @@ end function rhoDotFlux ! plane normals and signed cosine of the angle between the slip directions. Only the largest values ! that sum up to a total of 1 are considered, all others are set to zero. !-------------------------------------------------------------------------------------------------- -module subroutine plastic_nonlocal_updateCompatibility(orientation,instance,i,e) +module subroutine plastic_nonlocal_updateCompatibility(orientation,ph,i,e) type(rotation), dimension(1,discretization_nIPs,discretization_Nelems), intent(in) :: & orientation ! crystal orientation integer, intent(in) :: & - instance, & + ph, & i, & e @@ -1439,19 +1437,17 @@ module subroutine plastic_nonlocal_updateCompatibility(orientation,instance,i,e) ns, & ! number of active slip systems s1, & ! slip system index (me) s2 ! slip system index (my neighbor) - real(pReal), dimension(2,param(instance)%sum_N_sl,param(instance)%sum_N_sl,nIPneighbors) :: & + real(pReal), dimension(2,param(ins(ph))%sum_N_sl,param(ins(ph))%sum_N_sl,nIPneighbors) :: & my_compatibility ! my_compatibility for current element and ip real(pReal) :: & my_compatibilitySum, & thresholdValue, & nThresholdValues - logical, dimension(param(instance)%sum_N_sl) :: & + logical, dimension(param(ins(ph))%sum_N_sl) :: & belowThreshold type(rotation) :: mis - ph = material_phaseAt(1,e) - - associate(prm => param(instance)) + associate(prm => param(ins(ph))) ns = prm%sum_N_sl !*** start out fully compatible @@ -1537,14 +1533,14 @@ end subroutine plastic_nonlocal_updateCompatibility !-------------------------------------------------------------------------------------------------- !> @brief writes results to HDF5 output file !-------------------------------------------------------------------------------------------------- -module subroutine plastic_nonlocal_results(instance,group) +module subroutine plastic_nonlocal_results(ph,group) - integer, intent(in) :: instance + integer, intent(in) :: ph character(len=*),intent(in) :: group integer :: o - associate(prm => param(instance),dst => microstructure(instance),stt=>state(instance)) + associate(prm => param(ins(ph)),dst => microstructure(ins(ph)),stt=>state(ins(ph))) outputsLoop: do o = 1,size(prm%output) select case(trim(prm%output(o))) case('rho_u_ed_pos') @@ -1608,14 +1604,13 @@ end subroutine plastic_nonlocal_results !-------------------------------------------------------------------------------------------------- !> @brief populates the initial dislocation density !-------------------------------------------------------------------------------------------------- -subroutine stateInit(ini,phase,Nconstituents,instance) +subroutine stateInit(ini,phase,Nconstituents) type(tInitialParameters) :: & ini integer,intent(in) :: & phase, & - Nconstituents, & - instance + Nconstituents integer :: & e, & i, & @@ -1636,7 +1631,7 @@ subroutine stateInit(ini,phase,Nconstituents,instance) volume - associate(stt => state(instance)) + associate(stt => state(ins(phase))) if (ini%random_rho_u > 0.0_pReal) then ! randomly distribute dislocation segments on random slip system and of random type in the volume do e = 1,discretization_Nelems @@ -1684,18 +1679,18 @@ end subroutine stateInit !-------------------------------------------------------------------------------------------------- !> @brief calculates kinetics !-------------------------------------------------------------------------------------------------- -pure subroutine kinetics(v, dv_dtau, dv_dtauNS, tau, tauNS, tauThreshold, c, Temperature, instance) +pure subroutine kinetics(v, dv_dtau, dv_dtauNS, tau, tauNS, tauThreshold, c, Temperature, ph) integer, intent(in) :: & c, & !< dislocation character (1:edge, 2:screw) - instance + ph real(pReal), intent(in) :: & Temperature !< temperature - real(pReal), dimension(param(instance)%sum_N_sl), intent(in) :: & + real(pReal), dimension(param(ins(ph))%sum_N_sl), intent(in) :: & tau, & !< resolved external shear stress (without non Schmid effects) tauNS, & !< resolved external shear stress (including non Schmid effects) tauThreshold !< threshold shear stress - real(pReal), dimension(param(instance)%sum_N_sl), intent(out) :: & + real(pReal), dimension(param(ins(ph))%sum_N_sl), intent(out) :: & v, & !< velocity dv_dtau, & !< velocity derivative with respect to resolved shear stress (without non Schmid contributions) dv_dtauNS !< velocity derivative with respect to resolved shear stress (including non Schmid contributions) @@ -1726,7 +1721,7 @@ pure subroutine kinetics(v, dv_dtau, dv_dtauNS, tau, tauNS, tauThreshold, c, Tem criticalStress_S, & !< maximum obstacle strength mobility !< dislocation mobility - associate(prm => param(instance)) + associate(prm => param(ins(ph))) ns = prm%sum_N_sl v = 0.0_pReal dv_dtau = 0.0_pReal @@ -1799,14 +1794,14 @@ end subroutine kinetics !> @brief returns copy of current dislocation densities from state !> @details raw values is rectified !-------------------------------------------------------------------------------------------------- -pure function getRho(instance,me,ip,el) +pure function getRho(ph,me,ip,el) - integer, intent(in) :: instance, me,ip,el - real(pReal), dimension(param(instance)%sum_N_sl,10) :: getRho + integer, intent(in) :: ph, me,ip,el + real(pReal), dimension(param(ins(ph))%sum_N_sl,10) :: getRho - associate(prm => param(instance)) + associate(prm => param(ins(ph))) - getRho = reshape(state(instance)%rho(:,me),[prm%sum_N_sl,10]) + getRho = reshape(state(ins(ph))%rho(:,me),[prm%sum_N_sl,10]) ! ensure positive densities (not for imm, they have a sign) getRho(:,mob) = max(getRho(:,mob),0.0_pReal) @@ -1824,14 +1819,14 @@ end function getRho !> @brief returns copy of current dislocation densities from state !> @details raw values is rectified !-------------------------------------------------------------------------------------------------- -pure function getRho0(instance,me,ip,el) +pure function getRho0(ph,me,ip,el) - integer, intent(in) :: instance, me,ip,el - real(pReal), dimension(param(instance)%sum_N_sl,10) :: getRho0 + integer, intent(in) :: ph, me,ip,el + real(pReal), dimension(param(ins(ph))%sum_N_sl,10) :: getRho0 - associate(prm => param(instance)) + associate(prm => param(ins(ph))) - getRho0 = reshape(state0(instance)%rho(:,me),[prm%sum_N_sl,10]) + getRho0 = reshape(state0(ins(ph))%rho(:,me),[prm%sum_N_sl,10]) ! ensure positive densities (not for imm, they have a sign) getRho0(:,mob) = max(getRho0(:,mob),0.0_pReal) From f46d212e47bdc3e675092dc236ee99a0dd3e3b66 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 14 Feb 2021 17:29:23 +0100 Subject: [PATCH 52/60] simplified access pattern --- src/phase_mechanical.f90 | 23 +++--- src/phase_mechanical_plastic.f90 | 34 ++++----- src/phase_mechanical_plastic_nonlocal.f90 | 85 ++++++++++------------- 3 files changed, 56 insertions(+), 86 deletions(-) diff --git a/src/phase_mechanical.f90 b/src/phase_mechanical.f90 index 824c1e257..381820dcc 100644 --- a/src/phase_mechanical.f90 +++ b/src/phase_mechanical.f90 @@ -85,11 +85,8 @@ submodule(phase) mechanical logical :: broken end function plastic_dotState - module function plastic_deltaState(co, ip, el, ph, me) result(broken) + module function plastic_deltaState(ph, me) result(broken) integer, intent(in) :: & - co, & !< component-ID of integration point - ip, & !< integration point - el, & !< element ph, & me logical :: & @@ -114,11 +111,9 @@ submodule(phase) mechanical module subroutine plastic_LpAndItsTangents(Lp, dLp_dS, dLp_dFi, & - S, Fi, co, ip, el) + S, Fi, ph,me) integer, intent(in) :: & - co, & !< component-ID of integration point - ip, & !< integration point - el !< element + ph,me real(pReal), intent(in), dimension(3,3) :: & S, & !< 2nd Piola-Kirchhoff stress Fi !< intermediate deformation gradient @@ -538,7 +533,7 @@ function integrateStress(F,subFp0,subFi0,Delta_t,co,ip,el) result(broken) Fe, Fi_new, co, ip, el) call plastic_LpAndItsTangents(Lp_constitutive, dLp_dS, dLp_dFi, & - S, Fi_new, co, ip, el) + S, Fi_new, ph,me) !* update current residuum and check for convergence of loop atol_Lp = max(num%rtol_crystalliteStress * max(norm2(Lpguess),norm2(Lp_constitutive)), & ! absolute tolerance from largest acceptable relative error @@ -702,7 +697,7 @@ function integrateStateFPI(F_0,F,subFp0,subFi0,subState0,Delta_t,co,ip,el) resul plasticState(ph)%state(1:sizeDotState,me) = plasticState(ph)%state(1:sizeDotState,me) & - r(1:sizeDotState) if (converged(r(1:sizeDotState),plasticState(ph)%state(1:sizeDotState,me),plasticState(ph)%atol(1:sizeDotState))) then - broken = plastic_deltaState(co,ip,el,ph,me) + broken = plastic_deltaState(ph,me) exit iteration endif @@ -765,7 +760,7 @@ function integrateStateEuler(F_0,F,subFp0,subFi0,subState0,Delta_t,co,ip,el) res plasticState(ph)%state(1:sizeDotState,me) = subState0 & + plasticState(ph)%dotState(1:sizeDotState,me) * Delta_t - broken = plastic_deltaState(co,ip,el,ph,me) + broken = plastic_deltaState(ph,me) if(broken) return broken = integrateStress(F,subFp0,subFi0,Delta_t,co,ip,el) @@ -807,7 +802,7 @@ function integrateStateAdaptiveEuler(F_0,F,subFp0,subFi0,subState0,Delta_t,co,ip plasticState(ph)%state(1:sizeDotState,me) = subState0 & + plasticState(ph)%dotstate(1:sizeDotState,me) * Delta_t - broken = plastic_deltaState(co,ip,el,ph,me) + broken = plastic_deltaState(ph,me) if(broken) return broken = integrateStress(F,subFp0,subFi0,Delta_t,co,ip,el) @@ -956,7 +951,7 @@ function integrateStateRK(F_0,F,subFp0,subFi0,subState0,Delta_t,co,ip,el,A,B,C,D if(broken) return - broken = plastic_deltaState(co,ip,el,ph,me) + broken = plastic_deltaState(ph,me) if(broken) return broken = integrateStress(F,subFp0,subFi0,Delta_t,co,ip,el) @@ -1329,7 +1324,7 @@ module function phase_mechanical_dPdF(dt,co,ip,el) result(dPdF) call plastic_LpAndItsTangents(devNull,dLpdS,dLpdFi, & phase_mechanical_S(ph)%data(1:3,1:3,me), & - phase_mechanical_Fi(ph)%data(1:3,1:3,me),co,ip,el) + phase_mechanical_Fi(ph)%data(1:3,1:3,me),ph,me) dLpdS = math_mul3333xx3333(dLpdFi,dFidS) + dLpdS !-------------------------------------------------------------------------------------------------- diff --git a/src/phase_mechanical_plastic.f90 b/src/phase_mechanical_plastic.f90 index cf9faf6c9..c8e9b6271 100644 --- a/src/phase_mechanical_plastic.f90 +++ b/src/phase_mechanical_plastic.f90 @@ -104,7 +104,7 @@ submodule(phase:mechanical) plastic end subroutine dislotungsten_LpAndItsTangent module subroutine nonlocal_LpAndItsTangent(Lp,dLp_dMp, & - Mp,Temperature,ph,me,ip,el) + Mp,Temperature,ph,me) real(pReal), dimension(3,3), intent(out) :: & Lp real(pReal), dimension(3,3,3,3), intent(out) :: & @@ -116,9 +116,7 @@ submodule(phase:mechanical) plastic Temperature integer, intent(in) :: & ph, & - me, & - ip, & !< current integration point - el !< current element number + me end subroutine nonlocal_LpAndItsTangent @@ -209,14 +207,12 @@ submodule(phase:mechanical) plastic me end subroutine plastic_kinehardening_deltaState - module subroutine plastic_nonlocal_deltaState(Mp,ph,me,ip,el) + module subroutine plastic_nonlocal_deltaState(Mp,ph,me) real(pReal), dimension(3,3), intent(in) :: & Mp integer, intent(in) :: & ph, & - me, & - ip, & - el + me end subroutine plastic_nonlocal_deltaState end interface @@ -244,11 +240,9 @@ end subroutine plastic_init ! Mp in, dLp_dMp out !-------------------------------------------------------------------------------------------------- module subroutine plastic_LpAndItsTangents(Lp, dLp_dS, dLp_dFi, & - S, Fi, co, ip, el) + S, Fi, ph,me) integer, intent(in) :: & - co, & !< component-ID of integration point - ip, & !< integration point - el !< element + ph,me real(pReal), intent(in), dimension(3,3) :: & S, & !< 2nd Piola-Kirchhoff stress Fi !< intermediate deformation gradient @@ -263,14 +257,13 @@ module subroutine plastic_LpAndItsTangents(Lp, dLp_dS, dLp_dFi, & real(pReal), dimension(3,3) :: & Mp !< Mandel stress work conjugate with Lp integer :: & - i, j, me, ph + i, j Mp = matmul(matmul(transpose(Fi),Fi),S) - me = material_phasememberAt(co,ip,el) - ph = material_phaseAt(co,el) - plasticType: select case (phase_plasticity(material_phaseAt(co,el))) + + plasticType: select case (phase_plasticity(ph)) case (PLASTICITY_NONE_ID) plasticType Lp = 0.0_pReal @@ -286,7 +279,7 @@ module subroutine plastic_LpAndItsTangents(Lp, dLp_dS, dLp_dFi, & call kinehardening_LpAndItsTangent(Lp,dLp_dMp,Mp,ph,me) case (PLASTICITY_NONLOCAL_ID) plasticType - call nonlocal_LpAndItsTangent(Lp,dLp_dMp,Mp, thermal_T(ph,me),ph,me,ip,el) + call nonlocal_LpAndItsTangent(Lp,dLp_dMp,Mp, thermal_T(ph,me),ph,me) case (PLASTICITY_DISLOTWIN_ID) plasticType call dislotwin_LpAndItsTangent(Lp,dLp_dMp,Mp, thermal_T(ph,me),ph,me) @@ -391,12 +384,9 @@ end subroutine plastic_dependentState !> @brief for constitutive models having an instantaneous change of state !> will return false if delta state is not needed/supported by the constitutive model !-------------------------------------------------------------------------------------------------- -module function plastic_deltaState(co, ip, el, ph, me) result(broken) +module function plastic_deltaState(ph, me) result(broken) integer, intent(in) :: & - co, & !< component-ID of integration point - ip, & !< integration point - el, & !< element ph, & me logical :: & @@ -421,7 +411,7 @@ module function plastic_deltaState(co, ip, el, ph, me) result(broken) broken = any(IEEE_is_NaN(plasticState(ph)%deltaState(:,me))) case (PLASTICITY_NONLOCAL_ID) plasticType - call plastic_nonlocal_deltaState(Mp,ph,me,ip,el) + call plastic_nonlocal_deltaState(Mp,ph,me) broken = any(IEEE_is_NaN(plasticState(ph)%deltaState(:,me))) case default diff --git a/src/phase_mechanical_plastic_nonlocal.f90 b/src/phase_mechanical_plastic_nonlocal.f90 index 1f6fce029..b579a3164 100644 --- a/src/phase_mechanical_plastic_nonlocal.f90 +++ b/src/phase_mechanical_plastic_nonlocal.f90 @@ -512,7 +512,7 @@ module function plastic_nonlocal_init() result(myPlasticity) allocate(dst%tau_back(prm%sum_N_sl,Nconstituents),source=0.0_pReal) end associate - if (Nconstituents > 0) call stateInit(ini,p,Nconstituents) + if (Nconstituents > 0) call stateInit(ini,p,Nconstituents,i) plasticState(p)%state0 = plasticState(p)%state !-------------------------------------------------------------------------------------------------- @@ -576,7 +576,6 @@ module subroutine nonlocal_dependentState(ph, me, ip, el) el integer :: & - ph, & no, & !< neighbor offset neighbor_el, & ! element number of neighboring material point neighbor_ip, & ! integration point of neighboring material point @@ -626,7 +625,7 @@ module subroutine nonlocal_dependentState(ph, me, ip, el) associate(prm => param(ins(ph)),dst => microstructure(ins(ph)), stt => state(ins(ph))) - rho = getRho(ph,me,ip,el) + rho = getRho(ph,me) stt%rho_forest(:,me) = matmul(prm%forestProjection_Edge, sum(abs(rho(:,edg)),2)) & + matmul(prm%forestProjection_Screw,sum(abs(rho(:,scr)),2)) @@ -654,7 +653,7 @@ module subroutine nonlocal_dependentState(ph, me, ip, el) ! ToDo: MD: this is most likely only correct for F_i = I !################################################################################################# - rho0 = getRho0(ph,me,ip,el) + rho0 = getRho0(ph,me) if (.not. phase_localPlasticity(material_phaseAt(1,el)) .and. prm%shortRangeStressCorrection) then invFp = math_inv33(phase_mechanical_Fp(ph)%data(1:3,1:3,me)) invFe = math_inv33(phase_mechanical_Fe(ph)%data(1:3,1:3,me)) @@ -665,7 +664,7 @@ module subroutine nonlocal_dependentState(ph, me, ip, el) rhoExcess(1,:) = rho_edg_delta rhoExcess(2,:) = rho_scr_delta - FVsize = IPvolume(ip,el) ** (1.0_pReal/3.0_pReal) + FVsize = geom(ph)%V_0(me) ** (1.0_pReal/3.0_pReal) !* loop through my neighborhood and get the connection vectors (in lattice frame) and the excess densities @@ -680,7 +679,7 @@ module subroutine nonlocal_dependentState(ph, me, ip, el) if (neighbor_instance == ins(ph)) then nRealNeighbors = nRealNeighbors + 1.0_pReal - rho_neighbor0 = getRho0(ph,no,neighbor_ip,neighbor_el) + rho_neighbor0 = getRho0(ph,no) rho_edg_delta_neighbor(:,n) = rho_neighbor0(:,mob_edg_pos) - rho_neighbor0(:,mob_edg_neg) rho_scr_delta_neighbor(:,n) = rho_neighbor0(:,mob_scr_pos) - rho_neighbor0(:,mob_scr_neg) @@ -772,16 +771,14 @@ end subroutine nonlocal_dependentState !> @brief calculates plastic velocity gradient and its tangent !-------------------------------------------------------------------------------------------------- module subroutine nonlocal_LpAndItsTangent(Lp,dLp_dMp, & - Mp,Temperature,ph,me,ip,el) + Mp,Temperature,ph,me) real(pReal), dimension(3,3), intent(out) :: & Lp !< plastic velocity gradient real(pReal), dimension(3,3,3,3), intent(out) :: & dLp_dMp integer, intent(in) :: & ph, & - me, & - ip, & !< current integration point - el !< current element number + me real(pReal), intent(in) :: & Temperature !< temperature @@ -814,7 +811,7 @@ module subroutine nonlocal_LpAndItsTangent(Lp,dLp_dMp, & ns = prm%sum_N_sl !*** shortcut to state variables - rho = getRho(ph,me,ip,el) + rho = getRho(ph,me) rhoSgl = rho(:,sgl) do s = 1,ns @@ -880,18 +877,15 @@ end subroutine nonlocal_LpAndItsTangent !-------------------------------------------------------------------------------------------------- !> @brief (instantaneous) incremental change of microstructure !-------------------------------------------------------------------------------------------------- -module subroutine plastic_nonlocal_deltaState(Mp,ph,me,ip,el) +module subroutine plastic_nonlocal_deltaState(Mp,ph,me) real(pReal), dimension(3,3), intent(in) :: & Mp !< MandelStress integer, intent(in) :: & ph, & - me, & !< offset - ip, & - el + me integer :: & - ph, & !< phase ns, & ! short notation for the total number of active slip systems c, & ! character of dislocation t, & ! type of dislocation @@ -918,7 +912,7 @@ module subroutine plastic_nonlocal_deltaState(Mp,ph,me,ip,el) forall (s = 1:ns, t = 1:4) v(s,t) = plasticState(ph)%state(iV(s,t,ins(ph)),me) forall (s = 1:ns, c = 1:2) dUpperOld(s,c) = plasticState(ph)%state(iD(s,c,ins(ph)),me) - rho = getRho(ph,me,ip,el) + rho = getRho(ph,me) rhoDip = rho(:,dip) !**************************************************************************** @@ -968,15 +962,6 @@ module subroutine plastic_nonlocal_deltaState(Mp,ph,me,ip,el) plasticState(ph)%deltaState(:,me) = 0.0_pReal del%rho(:,me) = reshape(deltaRhoRemobilization + deltaRhoDipole2SingleStress, [10*ns]) -#ifdef DEBUG - if (debugConstitutive%extensive & - .and. ((debugConstitutive%element == el .and. debugConstitutive%ip == ip)& - .or. .not. debugConstitutive%selective)) then - print'(a,/,8(12x,12(e12.5,1x),/))', '<< CONST >> dislocation remobilization', deltaRhoRemobilization(:,1:8) - print'(a,/,10(12x,12(e12.5,1x),/),/)', '<< CONST >> dipole dissociation by stress increase', deltaRhoDipole2SingleStress - endif -#endif - end associate end subroutine plastic_nonlocal_deltaState @@ -1043,10 +1028,10 @@ module subroutine nonlocal_dotState(Mp, Temperature,timestep, & tau = 0.0_pReal gdot = 0.0_pReal - rho = getRho(ph,me,ip,el) + rho = getRho(ph,me) rhoSgl = rho(:,sgl) rhoDip = rho(:,dip) - rho0 = getRho0(ph,me,ip,el) + rho0 = getRho0(ph,me) my_rhoSgl0 = rho0(:,sgl) forall (s = 1:ns, t = 1:4) v(s,t) = plasticState(ph)%state(iV(s,t,ins(ph)),me) @@ -1194,7 +1179,6 @@ function rhoDotFlux(timestep,ph,me,ip,el) el !< current element number integer :: & - ph, & neighbor_instance, & !< instance of my neighbor's plasticity ns, & !< short notation for the total number of active slip systems c, & !< character of dislocation @@ -1251,9 +1235,9 @@ function rhoDotFlux(timestep,ph,me,ip,el) gdot = 0.0_pReal - rho = getRho(ph,me,ip,el) + rho = getRho(ph,me) rhoSgl = rho(:,sgl) - rho0 = getRho0(ph,me,ip,el) + rho0 = getRho0(ph,me) my_rhoSgl0 = rho0(:,sgl) forall (s = 1:ns, t = 1:4) v(s,t) = plasticState(ph)%state(iV(s,t,ins(ph)),me) !ToDo: MD: I think we should use state0 here @@ -1432,7 +1416,6 @@ module subroutine plastic_nonlocal_updateCompatibility(orientation,ph,i,e) n, & ! neighbor index neighbor_e, & ! element index of my neighbor neighbor_i, & ! integration point index of my neighbor - ph, & neighbor_phase, & ns, & ! number of active slip systems s1, & ! slip system index (me) @@ -1604,7 +1587,7 @@ end subroutine plastic_nonlocal_results !-------------------------------------------------------------------------------------------------- !> @brief populates the initial dislocation density !-------------------------------------------------------------------------------------------------- -subroutine stateInit(ini,phase,Nconstituents) +subroutine stateInit(ini,phase,Nconstituents,i) type(tInitialParameters) :: & ini @@ -1631,7 +1614,7 @@ subroutine stateInit(ini,phase,Nconstituents) volume - associate(stt => state(ins(phase))) + associate(stt => state(i)) if (ini%random_rho_u > 0.0_pReal) then ! randomly distribute dislocation segments on random slip system and of random type in the volume do e = 1,discretization_Nelems @@ -1794,21 +1777,22 @@ end subroutine kinetics !> @brief returns copy of current dislocation densities from state !> @details raw values is rectified !-------------------------------------------------------------------------------------------------- -pure function getRho(ph,me,ip,el) +pure function getRho(ph,me) - integer, intent(in) :: ph, me,ip,el + integer, intent(in) :: ph, me real(pReal), dimension(param(ins(ph))%sum_N_sl,10) :: getRho + associate(prm => param(ins(ph))) - getRho = reshape(state(ins(ph))%rho(:,me),[prm%sum_N_sl,10]) + getRho = reshape(state(ins(ph))%rho(:,me),[prm%sum_N_sl,10]) - ! ensure positive densities (not for imm, they have a sign) - getRho(:,mob) = max(getRho(:,mob),0.0_pReal) - getRho(:,dip) = max(getRho(:,dip),0.0_pReal) + ! ensure positive densities (not for imm, they have a sign) + getRho(:,mob) = max(getRho(:,mob),0.0_pReal) + getRho(:,dip) = max(getRho(:,dip),0.0_pReal) - where(abs(getRho) < max(prm%rho_min/IPvolume(ip,el)**(2.0_pReal/3.0_pReal),prm%rho_significant)) & - getRho = 0.0_pReal + where(abs(getRho) < max(prm%rho_min/geom(ph)%V_0(me)**(2.0_pReal/3.0_pReal),prm%rho_significant)) & + getRho = 0.0_pReal end associate @@ -1819,21 +1803,22 @@ end function getRho !> @brief returns copy of current dislocation densities from state !> @details raw values is rectified !-------------------------------------------------------------------------------------------------- -pure function getRho0(ph,me,ip,el) +pure function getRho0(ph,me) - integer, intent(in) :: ph, me,ip,el + integer, intent(in) :: ph, me real(pReal), dimension(param(ins(ph))%sum_N_sl,10) :: getRho0 + associate(prm => param(ins(ph))) - getRho0 = reshape(state0(ins(ph))%rho(:,me),[prm%sum_N_sl,10]) + getRho0 = reshape(state0(ins(ph))%rho(:,me),[prm%sum_N_sl,10]) - ! ensure positive densities (not for imm, they have a sign) - getRho0(:,mob) = max(getRho0(:,mob),0.0_pReal) - getRho0(:,dip) = max(getRho0(:,dip),0.0_pReal) + ! ensure positive densities (not for imm, they have a sign) + getRho0(:,mob) = max(getRho0(:,mob),0.0_pReal) + getRho0(:,dip) = max(getRho0(:,dip),0.0_pReal) - where(abs(getRho0) < max(prm%rho_min/IPvolume(ip,el)**(2.0_pReal/3.0_pReal),prm%rho_significant)) & - getRho0 = 0.0_pReal + where(abs(getRho0) < max(prm%rho_min/geom(ph)%V_0(me)**(2.0_pReal/3.0_pReal),prm%rho_significant)) & + getRho0 = 0.0_pReal end associate From 341e8ddd6a7d60631d0a212d3c30009fa75e7be6 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 14 Feb 2021 18:30:57 +0100 Subject: [PATCH 53/60] storing per instance does not add any value --- src/phase.f90 | 3 +- src/phase_mechanical.f90 | 2 - src/phase_mechanical_plastic.f90 | 5 +- src/phase_mechanical_plastic_nonlocal.f90 | 166 +++++++++++----------- 4 files changed, 82 insertions(+), 94 deletions(-) diff --git a/src/phase.f90 b/src/phase.f90 index 39d5cc340..a36ddc157 100644 --- a/src/phase.f90 +++ b/src/phase.f90 @@ -59,8 +59,7 @@ module phase integer, dimension(:), allocatable, public :: & !< ToDo: should be protected (bug in Intel compiler) phase_elasticityInstance, & - phase_NstiffnessDegradations, & !< number of stiffness degradation mechanisms active in each phase - phase_plasticInstance + phase_NstiffnessDegradations logical, dimension(:), allocatable, public :: & ! ToDo: should be protected (bug in Intel Compiler) phase_localPlasticity !< flags phases with local constitutive law diff --git a/src/phase_mechanical.f90 b/src/phase_mechanical.f90 index 381820dcc..57d4ea5ec 100644 --- a/src/phase_mechanical.f90 +++ b/src/phase_mechanical.f90 @@ -298,14 +298,12 @@ module subroutine mechanical_init(phases) ! initialize plasticity allocate(plasticState(phases%length)) allocate(phase_plasticity(phases%length),source = PLASTICITY_undefined_ID) - allocate(phase_plasticInstance(phases%length),source = 0) allocate(phase_localPlasticity(phases%length), source=.true.) call plastic_init() do ph = 1, phases%length phase_elasticityInstance(ph) = count(phase_elasticity(1:ph) == phase_elasticity(ph)) - phase_plasticInstance(ph) = count(phase_plasticity(1:ph) == phase_plasticity(ph)) enddo num_crystallite => config_numerics%get('crystallite',defaultVal=emptyDict) diff --git a/src/phase_mechanical_plastic.f90 b/src/phase_mechanical_plastic.f90 index c8e9b6271..136f0884c 100644 --- a/src/phase_mechanical_plastic.f90 +++ b/src/phase_mechanical_plastic.f90 @@ -357,12 +357,11 @@ module subroutine plastic_dependentState(co, ip, el) integer :: & ph, & - instance, me + me ph = material_phaseAt(co,el) me = material_phasememberAt(co,ip,el) - instance = phase_plasticInstance(ph) plasticType: select case (phase_plasticity(material_phaseAt(co,el))) @@ -395,14 +394,12 @@ module function plastic_deltaState(ph, me) result(broken) real(pReal), dimension(3,3) :: & Mp integer :: & - instance, & myOffset, & mySize Mp = matmul(matmul(transpose(phase_mechanical_Fi(ph)%data(1:3,1:3,me)),& phase_mechanical_Fi(ph)%data(1:3,1:3,me)),phase_mechanical_S(ph)%data(1:3,1:3,me)) - instance = phase_plasticInstance(ph) plasticType: select case (phase_plasticity(ph)) diff --git a/src/phase_mechanical_plastic_nonlocal.f90 b/src/phase_mechanical_plastic_nonlocal.f90 index b579a3164..0212baee8 100644 --- a/src/phase_mechanical_plastic_nonlocal.f90 +++ b/src/phase_mechanical_plastic_nonlocal.f90 @@ -12,8 +12,6 @@ submodule(phase:plastic) nonlocal IParea => geometry_plastic_nonlocal_IParea0, & IPareaNormal => geometry_plastic_nonlocal_IPareaNormal0, & geometry_plastic_nonlocal_disable - use phase, & - ins => phase_plasticInstance type :: tGeometry real(pReal), dimension(:), allocatable :: V_0 @@ -215,20 +213,19 @@ module function plastic_nonlocal_init() result(myPlasticity) phases => config_material%get('phase') allocate(geom(phases%length)) - allocate(param(Ninstances)) - allocate(state(Ninstances)) - allocate(state0(Ninstances)) - allocate(dotState(Ninstances)) - allocate(deltaState(Ninstances)) - allocate(microstructure(Ninstances)) + allocate(param(phases%length)) + allocate(state(phases%length)) + allocate(state0(phases%length)) + allocate(dotState(phases%length)) + allocate(deltaState(phases%length)) + allocate(microstructure(phases%length)) - - i = 0 do p = 1, phases%length + if(.not. myPlasticity(p)) cycle phase => phases%get(p) mech => phase%get('mechanics') - if(.not. myPlasticity(p)) cycle - i = i + 1 + + i = p associate(prm => param(i), & dot => dotState(i), & stt => state(i), & @@ -512,7 +509,7 @@ module function plastic_nonlocal_init() result(myPlasticity) allocate(dst%tau_back(prm%sum_N_sl,Nconstituents),source=0.0_pReal) end associate - if (Nconstituents > 0) call stateInit(ini,p,Nconstituents,i) + if (Nconstituents > 0) call stateInit(ini,p,Nconstituents) plasticState(p)%state0 = plasticState(p)%state !-------------------------------------------------------------------------------------------------- @@ -525,16 +522,15 @@ module function plastic_nonlocal_init() result(myPlasticity) discretization_nIPs,discretization_Nelems), source=0.0_pReal) ! BEGIN DEPRECATED---------------------------------------------------------------------------------- - allocate(iRhoU(maxval(param%sum_N_sl),4,Ninstances), source=0) - allocate(iV(maxval(param%sum_N_sl),4,Ninstances), source=0) - allocate(iD(maxval(param%sum_N_sl),2,Ninstances), source=0) + allocate(iRhoU(maxval(param%sum_N_sl),4,phases%length), source=0) + allocate(iV(maxval(param%sum_N_sl),4,phases%length), source=0) + allocate(iD(maxval(param%sum_N_sl),2,phases%length), source=0) - i = 0 do p = 1, phases%length phase => phases%get(p) if(.not. myPlasticity(p)) cycle - i = i + 1 + i = p Nconstituents = count(material_phaseAt2 == p) l = 0 @@ -579,7 +575,6 @@ module subroutine nonlocal_dependentState(ph, me, ip, el) no, & !< neighbor offset neighbor_el, & ! element number of neighboring material point neighbor_ip, & ! integration point of neighboring material point - neighbor_instance, & ! instance of this plasticity of neighboring material point c, & ! index of dilsocation character (edge, screw) s, & ! slip system index dir, & @@ -603,27 +598,27 @@ module subroutine nonlocal_dependentState(ph, me, ip, el) invConnections real(pReal), dimension(3,nIPneighbors) :: & connection_latticeConf - real(pReal), dimension(2,param(ins(ph))%sum_N_sl) :: & + real(pReal), dimension(2,param(ph)%sum_N_sl) :: & rhoExcess - real(pReal), dimension(param(ins(ph))%sum_N_sl) :: & + real(pReal), dimension(param(ph)%sum_N_sl) :: & rho_edg_delta, & rho_scr_delta - real(pReal), dimension(param(ins(ph))%sum_N_sl,10) :: & + real(pReal), dimension(param(ph)%sum_N_sl,10) :: & rho, & rho0, & rho_neighbor0 - real(pReal), dimension(param(ins(ph))%sum_N_sl,param(ins(ph))%sum_N_sl) :: & + real(pReal), dimension(param(ph)%sum_N_sl,param(ph)%sum_N_sl) :: & myInteractionMatrix ! corrected slip interaction matrix - real(pReal), dimension(param(ins(ph))%sum_N_sl,nIPneighbors) :: & + real(pReal), dimension(param(ph)%sum_N_sl,nIPneighbors) :: & rho_edg_delta_neighbor, & rho_scr_delta_neighbor real(pReal), dimension(2,maxval(param%sum_N_sl),nIPneighbors) :: & neighbor_rhoExcess, & ! excess density at neighboring material point neighbor_rhoTotal ! total density at neighboring material point - real(pReal), dimension(3,param(ins(ph))%sum_N_sl,2) :: & + real(pReal), dimension(3,param(ph)%sum_N_sl,2) :: & m ! direction of dislocation motion - associate(prm => param(ins(ph)),dst => microstructure(ins(ph)), stt => state(ins(ph))) + associate(prm => param(ph),dst => microstructure(ph), stt => state(ph)) rho = getRho(ph,me) @@ -675,8 +670,7 @@ module subroutine nonlocal_dependentState(ph, me, ip, el) neighbor_ip = IPneighborhood(2,n,ip,el) no = material_phasememberAt(1,neighbor_ip,neighbor_el) if (neighbor_el > 0 .and. neighbor_ip > 0) then - neighbor_instance = ins(material_phaseAt(1,neighbor_el)) - if (neighbor_instance == ins(ph)) then + if (material_phaseAt(1,neighbor_el) == ph) then nRealNeighbors = nRealNeighbors + 1.0_pReal rho_neighbor0 = getRho0(ph,no) @@ -793,21 +787,21 @@ module subroutine nonlocal_LpAndItsTangent(Lp,dLp_dMp, & l, & t, & !< dislocation type s !< index of my current slip system - real(pReal), dimension(param(ins(ph))%sum_N_sl,8) :: & + real(pReal), dimension(param(ph)%sum_N_sl,8) :: & rhoSgl !< single dislocation densities (including blocked) - real(pReal), dimension(param(ins(ph))%sum_N_sl,10) :: & + real(pReal), dimension(param(ph)%sum_N_sl,10) :: & rho - real(pReal), dimension(param(ins(ph))%sum_N_sl,4) :: & + real(pReal), dimension(param(ph)%sum_N_sl,4) :: & v, & !< velocity tauNS, & !< resolved shear stress including non Schmid and backstress terms dv_dtau, & !< velocity derivative with respect to the shear stress dv_dtauNS !< velocity derivative with respect to the shear stress - real(pReal), dimension(param(ins(ph))%sum_N_sl) :: & + real(pReal), dimension(param(ph)%sum_N_sl) :: & tau, & !< resolved shear stress including backstress terms gdotTotal !< shear rate - associate(prm => param(ins(ph)),dst=>microstructure(ins(ph)),& - stt=>state(ins(ph))) + associate(prm => param(ph),dst=>microstructure(ph),& + stt=>state(ph)) ns = prm%sum_N_sl !*** shortcut to state variables @@ -890,27 +884,27 @@ module subroutine plastic_nonlocal_deltaState(Mp,ph,me) c, & ! character of dislocation t, & ! type of dislocation s ! index of my current slip system - real(pReal), dimension(param(ins(ph))%sum_N_sl,10) :: & + real(pReal), dimension(param(ph)%sum_N_sl,10) :: & deltaRhoRemobilization, & ! density increment by remobilization deltaRhoDipole2SingleStress ! density increment by dipole dissociation (by stress change) - real(pReal), dimension(param(ins(ph))%sum_N_sl,10) :: & + real(pReal), dimension(param(ph)%sum_N_sl,10) :: & rho ! current dislocation densities - real(pReal), dimension(param(ins(ph))%sum_N_sl,4) :: & + real(pReal), dimension(param(ph)%sum_N_sl,4) :: & v ! dislocation glide velocity - real(pReal), dimension(param(ins(ph))%sum_N_sl) :: & + real(pReal), dimension(param(ph)%sum_N_sl) :: & tau ! current resolved shear stress - real(pReal), dimension(param(ins(ph))%sum_N_sl,2) :: & + real(pReal), dimension(param(ph)%sum_N_sl,2) :: & rhoDip, & ! current dipole dislocation densities (screw and edge dipoles) dUpper, & ! current maximum stable dipole distance for edges and screws dUpperOld, & ! old maximum stable dipole distance for edges and screws deltaDUpper ! change in maximum stable dipole distance for edges and screws - associate(prm => param(ins(ph)),dst => microstructure(ins(ph)),del => deltaState(ins(ph))) + associate(prm => param(ph),dst => microstructure(ph),del => deltaState(ph)) ns = prm%sum_N_sl !*** shortcut to state variables - forall (s = 1:ns, t = 1:4) v(s,t) = plasticState(ph)%state(iV(s,t,ins(ph)),me) - forall (s = 1:ns, c = 1:2) dUpperOld(s,c) = plasticState(ph)%state(iD(s,c,ins(ph)),me) + forall (s = 1:ns, t = 1:4) v(s,t) = plasticState(ph)%state(iV(s,t,ph),me) + forall (s = 1:ns, c = 1:2) dUpperOld(s,c) = plasticState(ph)%state(iD(s,c,ph),me) rho = getRho(ph,me) rhoDip = rho(:,dip) @@ -957,7 +951,7 @@ module subroutine plastic_nonlocal_deltaState(Mp,ph,me) / (dUpperOld(s,c) - prm%minDipoleHeight(s,c)) forall (t=1:4) deltaRhoDipole2SingleStress(:,t) = -0.5_pReal * deltaRhoDipole2SingleStress(:,(t-1)/2+9) - forall (s = 1:ns, c = 1:2) plasticState(ph)%state(iD(s,c,ins(ph)),me) = dUpper(s,c) + forall (s = 1:ns, c = 1:2) plasticState(ph)%state(iD(s,c,ph),me) = dUpper(s,c) plasticState(ph)%deltaState(:,me) = 0.0_pReal del%rho(:,me) = reshape(deltaRhoRemobilization + deltaRhoDipole2SingleStress, [10*ns]) @@ -989,7 +983,7 @@ module subroutine nonlocal_dotState(Mp, Temperature,timestep, & c, & !< character of dislocation t, & !< type of dislocation s !< index of my current slip system - real(pReal), dimension(param(ins(ph))%sum_N_sl,10) :: & + real(pReal), dimension(param(ph)%sum_N_sl,10) :: & rho, & rho0, & !< dislocation density at beginning of time step rhoDot, & !< density evolution @@ -997,17 +991,17 @@ module subroutine nonlocal_dotState(Mp, Temperature,timestep, & rhoDotSingle2DipoleGlide, & !< density evolution by dipole formation (by glide) rhoDotAthermalAnnihilation, & !< density evolution by athermal annihilation rhoDotThermalAnnihilation !< density evolution by thermal annihilation - real(pReal), dimension(param(ins(ph))%sum_N_sl,8) :: & + real(pReal), dimension(param(ph)%sum_N_sl,8) :: & rhoSgl, & !< current single dislocation densities (positive/negative screw and edge without dipoles) my_rhoSgl0 !< single dislocation densities of central ip (positive/negative screw and edge without dipoles) - real(pReal), dimension(param(ins(ph))%sum_N_sl,4) :: & + real(pReal), dimension(param(ph)%sum_N_sl,4) :: & v, & !< current dislocation glide velocity v0, & gdot !< shear rates - real(pReal), dimension(param(ins(ph))%sum_N_sl) :: & + real(pReal), dimension(param(ph)%sum_N_sl) :: & tau, & !< current resolved shear stress vClimb !< climb velocity of edge dipoles - real(pReal), dimension(param(ins(ph))%sum_N_sl,2) :: & + real(pReal), dimension(param(ph)%sum_N_sl,2) :: & rhoDip, & !< current dipole dislocation densities (screw and edge dipoles) dLower, & !< minimum stable dipole distance for edges and screws dUpper !< current maximum stable dipole distance for edges and screws @@ -1019,10 +1013,10 @@ module subroutine nonlocal_dotState(Mp, Temperature,timestep, & return endif - associate(prm => param(ins(ph)), & - dst => microstructure(ins(ph)), & - dot => dotState(ins(ph)), & - stt => state(ins(ph))) + associate(prm => param(ph), & + dst => microstructure(ph), & + dot => dotState(ph), & + stt => state(ph)) ns = prm%sum_N_sl tau = 0.0_pReal @@ -1034,7 +1028,7 @@ module subroutine nonlocal_dotState(Mp, Temperature,timestep, & rho0 = getRho0(ph,me) my_rhoSgl0 = rho0(:,sgl) - forall (s = 1:ns, t = 1:4) v(s,t) = plasticState(ph)%state(iV(s,t,ins(ph)),me) + forall (s = 1:ns, t = 1:4) v(s,t) = plasticState(ph)%state(iV(s,t,ph),me) gdot = rhoSgl(:,1:4) * v * spread(prm%b_sl,2,4) #ifdef DEBUG @@ -1083,7 +1077,7 @@ module subroutine nonlocal_dotState(Mp, Temperature,timestep, & * sqrt(stt%rho_forest(:,me)) / prm%i_sl / prm%b_sl, 2, 4) endif isBCC - forall (s = 1:ns, t = 1:4) v0(s,t) = plasticState(ph)%state0(iV(s,t,ins(ph)),me) + forall (s = 1:ns, t = 1:4) v0(s,t) = plasticState(ph)%state0(iV(s,t,ph),me) !**************************************************************************** @@ -1179,7 +1173,7 @@ function rhoDotFlux(timestep,ph,me,ip,el) el !< current element number integer :: & - neighbor_instance, & !< instance of my neighbor's plasticity + neighbor_ph, & !< phase of my neighbor's plasticity ns, & !< short notation for the total number of active slip systems c, & !< character of dislocation n, & !< index of my current neighbor @@ -1195,20 +1189,20 @@ function rhoDotFlux(timestep,ph,me,ip,el) np,& !< neighbor phase shortcut topp, & !< type of dislocation with opposite sign to t s !< index of my current slip system - real(pReal), dimension(param(ins(ph))%sum_N_sl,10) :: & + real(pReal), dimension(param(ph)%sum_N_sl,10) :: & rho, & rho0, & !< dislocation density at beginning of time step rhoDotFlux !< density evolution by flux - real(pReal), dimension(param(ins(ph))%sum_N_sl,8) :: & + real(pReal), dimension(param(ph)%sum_N_sl,8) :: & rhoSgl, & !< current single dislocation densities (positive/negative screw and edge without dipoles) neighbor_rhoSgl0, & !< current single dislocation densities of neighboring ip (positive/negative screw and edge without dipoles) my_rhoSgl0 !< single dislocation densities of central ip (positive/negative screw and edge without dipoles) - real(pReal), dimension(param(ins(ph))%sum_N_sl,4) :: & + real(pReal), dimension(param(ph)%sum_N_sl,4) :: & v, & !< current dislocation glide velocity v0, & neighbor_v0, & !< dislocation glide velocity of enighboring ip gdot !< shear rates - real(pReal), dimension(3,param(ins(ph))%sum_N_sl,4) :: & + real(pReal), dimension(3,param(ph)%sum_N_sl,4) :: & m !< direction of dislocation motion real(pReal), dimension(3,3) :: & my_F, & !< my total deformation gradient @@ -1227,10 +1221,10 @@ function rhoDotFlux(timestep,ph,me,ip,el) lineLength !< dislocation line length leaving the current interface - associate(prm => param(ins(ph)), & - dst => microstructure(ins(ph)), & - dot => dotState(ins(ph)), & - stt => state(ins(ph))) + associate(prm => param(ph), & + dst => microstructure(ph), & + dot => dotState(ph), & + stt => state(ph)) ns = prm%sum_N_sl gdot = 0.0_pReal @@ -1240,11 +1234,11 @@ function rhoDotFlux(timestep,ph,me,ip,el) rho0 = getRho0(ph,me) my_rhoSgl0 = rho0(:,sgl) - forall (s = 1:ns, t = 1:4) v(s,t) = plasticState(ph)%state(iV(s,t,ins(ph)),me) !ToDo: MD: I think we should use state0 here + forall (s = 1:ns, t = 1:4) v(s,t) = plasticState(ph)%state(iV(s,t,ph),me) !ToDo: MD: I think we should use state0 here gdot = rhoSgl(:,1:4) * v * spread(prm%b_sl,2,4) - forall (s = 1:ns, t = 1:4) v0(s,t) = plasticState(ph)%state0(iV(s,t,ins(ph)),me) + forall (s = 1:ns, t = 1:4) v0(s,t) = plasticState(ph)%state0(iV(s,t,ph),me) !**************************************************************************** !*** calculate dislocation fluxes (only for nonlocal plasticity) @@ -1296,7 +1290,7 @@ function rhoDotFlux(timestep,ph,me,ip,el) opposite_n = IPneighborhood(3,opposite_neighbor,ip,el) if (neighbor_n > 0) then ! if neighbor exists, average deformation gradient - neighbor_instance = ins(material_phaseAt(1,neighbor_el)) + neighbor_ph = material_phaseAt(1,neighbor_el) neighbor_F = phase_mechanical_F(np)%data(1:3,1:3,no) neighbor_Fe = matmul(neighbor_F, math_inv33(phase_mechanical_Fp(np)%data(1:3,1:3,no))) Favg = 0.5_pReal * (my_F + neighbor_F) @@ -1319,8 +1313,8 @@ function rhoDotFlux(timestep,ph,me,ip,el) any(compatibility(:,:,:,n,ip,el) > 0.0_pReal)) then forall (s = 1:ns, t = 1:4) - neighbor_v0(s,t) = plasticState(np)%state0(iV (s,t,neighbor_instance),no) - neighbor_rhoSgl0(s,t) = max(plasticState(np)%state0(iRhoU(s,t,neighbor_instance),no),0.0_pReal) + neighbor_v0(s,t) = plasticState(np)%state0(iV (s,t,neighbor_ph),no) + neighbor_rhoSgl0(s,t) = max(plasticState(np)%state0(iRhoU(s,t,neighbor_ph),no),0.0_pReal) endforall where (neighbor_rhoSgl0 * IPvolume(neighbor_ip,neighbor_el) ** 0.667_pReal < prm%rho_min & @@ -1420,17 +1414,17 @@ module subroutine plastic_nonlocal_updateCompatibility(orientation,ph,i,e) ns, & ! number of active slip systems s1, & ! slip system index (me) s2 ! slip system index (my neighbor) - real(pReal), dimension(2,param(ins(ph))%sum_N_sl,param(ins(ph))%sum_N_sl,nIPneighbors) :: & + real(pReal), dimension(2,param(ph)%sum_N_sl,param(ph)%sum_N_sl,nIPneighbors) :: & my_compatibility ! my_compatibility for current element and ip real(pReal) :: & my_compatibilitySum, & thresholdValue, & nThresholdValues - logical, dimension(param(ins(ph))%sum_N_sl) :: & + logical, dimension(param(ph)%sum_N_sl) :: & belowThreshold type(rotation) :: mis - associate(prm => param(ins(ph))) + associate(prm => param(ph)) ns = prm%sum_N_sl !*** start out fully compatible @@ -1523,7 +1517,7 @@ module subroutine plastic_nonlocal_results(ph,group) integer :: o - associate(prm => param(ins(ph)),dst => microstructure(ins(ph)),stt=>state(ins(ph))) + associate(prm => param(ph),dst => microstructure(ph),stt=>state(ph)) outputsLoop: do o = 1,size(prm%output) select case(trim(prm%output(o))) case('rho_u_ed_pos') @@ -1587,7 +1581,7 @@ end subroutine plastic_nonlocal_results !-------------------------------------------------------------------------------------------------- !> @brief populates the initial dislocation density !-------------------------------------------------------------------------------------------------- -subroutine stateInit(ini,phase,Nconstituents,i) +subroutine stateInit(ini,phase,Nconstituents) type(tInitialParameters) :: & ini @@ -1595,8 +1589,8 @@ subroutine stateInit(ini,phase,Nconstituents,i) phase, & Nconstituents integer :: & - e, & i, & + e, & f, & from, & upto, & @@ -1614,7 +1608,7 @@ subroutine stateInit(ini,phase,Nconstituents,i) volume - associate(stt => state(i)) + associate(stt => state(phase)) if (ini%random_rho_u > 0.0_pReal) then ! randomly distribute dislocation segments on random slip system and of random type in the volume do e = 1,discretization_Nelems @@ -1643,8 +1637,8 @@ subroutine stateInit(ini,phase,Nconstituents,i) do s = from,upto noise = [math_sampleGaussVar(0.0_pReal, ini%sigma_rho_u), & math_sampleGaussVar(0.0_pReal, ini%sigma_rho_u)] - stt%rho_sgl_mob_edg_pos(s,e) = ini%rho_u_ed_pos_0(f) + noise(1) - stt%rho_sgl_mob_edg_neg(s,e) = ini%rho_u_ed_neg_0(f) + noise(1) + stt%rho_sgl_mob_edg_pos(s,e) = ini%rho_u_ed_pos_0(f) + noise(1) + stt%rho_sgl_mob_edg_neg(s,e) = ini%rho_u_ed_neg_0(f) + noise(1) stt%rho_sgl_mob_scr_pos(s,e) = ini%rho_u_sc_pos_0(f) + noise(2) stt%rho_sgl_mob_scr_neg(s,e) = ini%rho_u_sc_neg_0(f) + noise(2) enddo @@ -1669,11 +1663,11 @@ pure subroutine kinetics(v, dv_dtau, dv_dtauNS, tau, tauNS, tauThreshold, c, Tem ph real(pReal), intent(in) :: & Temperature !< temperature - real(pReal), dimension(param(ins(ph))%sum_N_sl), intent(in) :: & + real(pReal), dimension(param(ph)%sum_N_sl), intent(in) :: & tau, & !< resolved external shear stress (without non Schmid effects) tauNS, & !< resolved external shear stress (including non Schmid effects) tauThreshold !< threshold shear stress - real(pReal), dimension(param(ins(ph))%sum_N_sl), intent(out) :: & + real(pReal), dimension(param(ph)%sum_N_sl), intent(out) :: & v, & !< velocity dv_dtau, & !< velocity derivative with respect to resolved shear stress (without non Schmid contributions) dv_dtauNS !< velocity derivative with respect to resolved shear stress (including non Schmid contributions) @@ -1704,7 +1698,7 @@ pure subroutine kinetics(v, dv_dtau, dv_dtauNS, tau, tauNS, tauThreshold, c, Tem criticalStress_S, & !< maximum obstacle strength mobility !< dislocation mobility - associate(prm => param(ins(ph))) + associate(prm => param(ph)) ns = prm%sum_N_sl v = 0.0_pReal dv_dtau = 0.0_pReal @@ -1780,12 +1774,12 @@ end subroutine kinetics pure function getRho(ph,me) integer, intent(in) :: ph, me - real(pReal), dimension(param(ins(ph))%sum_N_sl,10) :: getRho + real(pReal), dimension(param(ph)%sum_N_sl,10) :: getRho - associate(prm => param(ins(ph))) + associate(prm => param(ph)) - getRho = reshape(state(ins(ph))%rho(:,me),[prm%sum_N_sl,10]) + getRho = reshape(state(ph)%rho(:,me),[prm%sum_N_sl,10]) ! ensure positive densities (not for imm, they have a sign) getRho(:,mob) = max(getRho(:,mob),0.0_pReal) @@ -1806,12 +1800,12 @@ end function getRho pure function getRho0(ph,me) integer, intent(in) :: ph, me - real(pReal), dimension(param(ins(ph))%sum_N_sl,10) :: getRho0 + real(pReal), dimension(param(ph)%sum_N_sl,10) :: getRho0 - associate(prm => param(ins(ph))) + associate(prm => param(ph)) - getRho0 = reshape(state0(ins(ph))%rho(:,me),[prm%sum_N_sl,10]) + getRho0 = reshape(state0(ph)%rho(:,me),[prm%sum_N_sl,10]) ! ensure positive densities (not for imm, they have a sign) getRho0(:,mob) = max(getRho0(:,mob),0.0_pReal) From 89e8ca45351297871bf54662283038ac011901ab Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Mon, 15 Feb 2021 11:22:42 -0500 Subject: [PATCH 54/60] renamed and shortened _separate_arguments() --- python/damask/_orientation.py | 55 +++++++++++++++++------------------ 1 file changed, 27 insertions(+), 28 deletions(-) diff --git a/python/damask/_orientation.py b/python/damask/_orientation.py index f01156903..ad381712d 100644 --- a/python/damask/_orientation.py +++ b/python/damask/_orientation.py @@ -9,7 +9,7 @@ from . import tensor _parameter_doc = \ """lattice : str Either a crystal family out of [triclinic, monoclinic, orthorhombic, tetragonal, hexagonal, cubic] - or a Bravais lattice out of [aP, mP, mS, oP, oS, oI, oF, tP, tI, hP, cP, cI, cF]. + or a Bravais lattice out of [aP, mP, mS, oP, oS, oI, oF, tP, tI, hP, cP, cI, cF]. When specifying a Bravais lattice, additional lattice parameters might be required: a : float, optional Length of lattice parameter "a". @@ -265,111 +265,110 @@ class Orientation(Rotation): @staticmethod - def _separate_arguments(parent_dict,function): + def _split_kwargs(kwargs,target): """ - Separate arguments required by Rotation and Orientation objects respectively. + Separate keyword arguments in 'kwargs' targeted at 'target' from general keyword arguments of Orientation objects. Parameters ---------- - parent_dict : Dictionary - Contains all **kwargs - function: Method - Function whose signature list is required + kwargs : dictionary + Contains all **kwargs. + target: method + Function to scan for kwarg signature. Returns ------- - ori_dict: dictionary - Dictionary consisting of valid keys accepted by Orientation class - rot_dict: dictionary - Dictionary consisting of valid keys accepted by 'function' in Rotation class + rot_kwargs: dictionary + Valid keyword arguments of 'target' function of Rotation class. + ori_kwargs: dictionary + Valid keyword arguments of Orientation object. """ - set_ori = set(inspect.signature(Orientation.__init__).parameters.keys()) & set(parent_dict.keys()) - set_rot = set(inspect.signature(function).parameters.keys()) & set(parent_dict.keys()) - ori_dict = {key: parent_dict[key] for key in set_ori} - rot_dict = {key: parent_dict[key] for key in set_rot} + kws = () + for t in (target,Orientation.__init__): + kws += ({key: kwargs[key] for key in set(inspect.signature(t).parameters) & set(kwargs)},) - invalid_keys = set(parent_dict.keys())-(set_ori|set_rot) + invalid_keys = set(kwargs)-(set(kws[0])|set(kws[1])) if invalid_keys: raise TypeError(f"{inspect.stack()[1][3]}() got an unexpected keyword argument '{invalid_keys.pop()}'") - return rot_dict,ori_dict + return kws @classmethod @util.extended_docstring(Rotation.from_random,_parameter_doc) def from_random(cls,**kwargs): - kwargs_rot,kwargs_ori = Orientation._separate_arguments(kwargs,Rotation.from_random) + kwargs_rot,kwargs_ori = Orientation._split_kwargs(kwargs,Rotation.from_random) return cls(rotation=Rotation.from_random(**kwargs_rot),**kwargs_ori) @classmethod @util.extended_docstring(Rotation.from_quaternion,_parameter_doc) def from_quaternion(cls,**kwargs): - kwargs_rot,kwargs_ori = Orientation._separate_arguments(kwargs,Rotation.from_quaternion) + kwargs_rot,kwargs_ori = Orientation._split_kwargs(kwargs,Rotation.from_quaternion) return cls(rotation=Rotation.from_quaternion(**kwargs_rot),**kwargs_ori) @classmethod @util.extended_docstring(Rotation.from_Euler_angles,_parameter_doc) def from_Euler_angles(cls,**kwargs): - kwargs_rot,kwargs_ori = Orientation._separate_arguments(kwargs,Rotation.from_Euler_angles) + kwargs_rot,kwargs_ori = Orientation._split_kwargs(kwargs,Rotation.from_Euler_angles) return cls(rotation=Rotation.from_Euler_angles(**kwargs_rot),**kwargs_ori) @classmethod @util.extended_docstring(Rotation.from_axis_angle,_parameter_doc) def from_axis_angle(cls,**kwargs): - kwargs_rot,kwargs_ori = Orientation._separate_arguments(kwargs,Rotation.from_axis_angle) + kwargs_rot,kwargs_ori = Orientation._split_kwargs(kwargs,Rotation.from_axis_angle) return cls(rotation=Rotation.from_axis_angle(**kwargs_rot),**kwargs_ori) @classmethod @util.extended_docstring(Rotation.from_basis,_parameter_doc) def from_basis(cls,**kwargs): - kwargs_rot,kwargs_ori = Orientation._separate_arguments(kwargs,Rotation.from_basis) + kwargs_rot,kwargs_ori = Orientation._split_kwargs(kwargs,Rotation.from_basis) return cls(rotation=Rotation.from_basis(**kwargs_rot),**kwargs_ori) @classmethod @util.extended_docstring(Rotation.from_matrix,_parameter_doc) def from_matrix(cls,**kwargs): - kwargs_rot,kwargs_ori = Orientation._separate_arguments(kwargs,Rotation.from_matrix) + kwargs_rot,kwargs_ori = Orientation._split_kwargs(kwargs,Rotation.from_matrix) return cls(rotation=Rotation.from_matrix(**kwargs_rot),**kwargs_ori) @classmethod @util.extended_docstring(Rotation.from_Rodrigues_vector,_parameter_doc) def from_Rodrigues_vector(cls,**kwargs): - kwargs_rot,kwargs_ori = Orientation._separate_arguments(kwargs,Rotation.from_Rodrigues_vector) + kwargs_rot,kwargs_ori = Orientation._split_kwargs(kwargs,Rotation.from_Rodrigues_vector) return cls(rotation=Rotation.from_Rodrigues_vector(**kwargs_rot),**kwargs_ori) @classmethod @util.extended_docstring(Rotation.from_homochoric,_parameter_doc) def from_homochoric(cls,**kwargs): - kwargs_rot,kwargs_ori = Orientation._separate_arguments(kwargs,Rotation.from_homochoric) + kwargs_rot,kwargs_ori = Orientation._split_kwargs(kwargs,Rotation.from_homochoric) return cls(rotation=Rotation.from_homochoric(**kwargs_rot),**kwargs_ori) @classmethod @util.extended_docstring(Rotation.from_cubochoric,_parameter_doc) def from_cubochoric(cls,**kwargs): - kwargs_rot,kwargs_ori = Orientation._separate_arguments(kwargs,Rotation.from_cubochoric) + kwargs_rot,kwargs_ori = Orientation._split_kwargs(kwargs,Rotation.from_cubochoric) return cls(rotation=Rotation.from_cubochoric(**kwargs_rot),**kwargs_ori) @classmethod @util.extended_docstring(Rotation.from_spherical_component,_parameter_doc) def from_spherical_component(cls,**kwargs): - kwargs_rot,kwargs_ori = Orientation._separate_arguments(kwargs,Rotation.from_spherical_component) + kwargs_rot,kwargs_ori = Orientation._split_kwargs(kwargs,Rotation.from_spherical_component) return cls(rotation=Rotation.from_spherical_component(**kwargs_rot),**kwargs_ori) @classmethod @util.extended_docstring(Rotation.from_fiber_component,_parameter_doc) def from_fiber_component(cls,**kwargs): - kwargs_rot,kwargs_ori = Orientation._separate_arguments(kwargs,Rotation.from_fiber_component) + kwargs_rot,kwargs_ori = Orientation._split_kwargs(kwargs,Rotation.from_fiber_component) return cls(rotation=Rotation.from_fiber_component(**kwargs_rot),**kwargs_ori) From 2af7502ed4d3216ef44579b04ecc60ee6f0c4765 Mon Sep 17 00:00:00 2001 From: Test User Date: Mon, 15 Feb 2021 22:12:13 +0100 Subject: [PATCH 55/60] [skip ci] updated version information after successful test of v3.0.0-alpha2-435-g8933dd856 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index ce989b710..5fddb7702 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v3.0.0-alpha2-428-gb7b764ab5 +v3.0.0-alpha2-435-g8933dd856 From 6bbd55d96711bba450f9f680e82e132dc2ab58ef Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Mon, 15 Feb 2021 16:25:36 -0500 Subject: [PATCH 56/60] exchanged c for x in from_cubochoric --- python/tests/test_Orientation.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/tests/test_Orientation.py b/python/tests/test_Orientation.py index 4d1f958e2..2870189ed 100644 --- a/python/tests/test_Orientation.py +++ b/python/tests/test_Orientation.py @@ -221,14 +221,14 @@ class TestOrientation: o = Orientation.from_random(lattice=lattice,shape=shape) for r, theO in zip(o.reduced.flatten(),o.flatten()): assert r == theO.reduced - + @pytest.mark.parametrize('lattice',Orientation.crystal_families) def test_reduced_corner_cases(self,lattice): # test whether there is always a sym-eq rotation that falls into the FZ N = np.random.randint(10,40) size = np.ones(3)*np.pi**(2./3.) grid = grid_filters.coordinates0_node([N+1,N+1,N+1],size,-size*.5) - evenly_distributed = Orientation.from_cubochoric(c=grid[:-2,:-2,:-2],lattice=lattice) + evenly_distributed = Orientation.from_cubochoric(x=grid[:-2,:-2,:-2],lattice=lattice) assert evenly_distributed.shape == evenly_distributed.reduced.shape From 7332a92b322d298a67957fe258866e8672634160 Mon Sep 17 00:00:00 2001 From: Test User Date: Tue, 16 Feb 2021 01:36:39 +0100 Subject: [PATCH 57/60] [skip ci] updated version information after successful test of v3.0.0-alpha2-442-ge2708d29f --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 5fddb7702..0a4efbf53 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v3.0.0-alpha2-435-g8933dd856 +v3.0.0-alpha2-442-ge2708d29f From 53bab41b4762eb3c8da911d3f409da800eb9ed16 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Tue, 16 Feb 2021 16:06:09 +0100 Subject: [PATCH 58/60] consistent name 'ph' and cleaning --- ...phase_mechanical_plastic_dislotungsten.f90 | 46 ++--- src/phase_mechanical_plastic_dislotwin.f90 | 75 ++++--- src/phase_mechanical_plastic_isotropic.f90 | 54 ++--- ...phase_mechanical_plastic_kinehardening.f90 | 73 +++---- src/phase_mechanical_plastic_none.f90 | 10 +- src/phase_mechanical_plastic_nonlocal.f90 | 189 +++++++++--------- ...phase_mechanical_plastic_phenopowerlaw.f90 | 57 +++--- 7 files changed, 235 insertions(+), 269 deletions(-) diff --git a/src/phase_mechanical_plastic_dislotungsten.f90 b/src/phase_mechanical_plastic_dislotungsten.f90 index 81c4605ac..9c8baf0a5 100644 --- a/src/phase_mechanical_plastic_dislotungsten.f90 +++ b/src/phase_mechanical_plastic_dislotungsten.f90 @@ -78,7 +78,7 @@ module function plastic_dislotungsten_init() result(myPlasticity) logical, dimension(:), allocatable :: myPlasticity integer :: & - p, i, & + ph, i, & Nconstituents, & sizeState, sizeDotState, & startIndex, endIndex @@ -114,15 +114,13 @@ module function plastic_dislotungsten_init() result(myPlasticity) allocate(dependentState(phases%length)) - do p = 1, phases%length - if(.not. myPlasticity(p)) cycle - phase => phases%get(p) + do ph = 1, phases%length + if(.not. myPlasticity(ph)) cycle + + associate(prm => param(ph), dot => dotState(ph), stt => state(ph), dst => dependentState(ph)) + + phase => phases%get(ph) mech => phase%get('mechanics') - i = p - associate(prm => param(i), & - dot => dotState(i), & - stt => state(i), & - dst => dependentState(i)) pl => mech%get('plasticity') #if defined (__GFORTRAN__) @@ -132,7 +130,7 @@ module function plastic_dislotungsten_init() result(myPlasticity) #endif ! This data is read in already in lattice - prm%mu = lattice_mu(p) + prm%mu = lattice_mu(ph) !-------------------------------------------------------------------------------------------------- ! slip related parameters @@ -222,41 +220,41 @@ module function plastic_dislotungsten_init() result(myPlasticity) !-------------------------------------------------------------------------------------------------- ! allocate state arrays - Nconstituents = count(material_phaseAt2 == p) + Nconstituents = count(material_phaseAt2 == ph) sizeDotState = size(['rho_mob ','rho_dip ','gamma_sl']) * prm%sum_N_sl sizeState = sizeDotState - call phase_allocateState(plasticState(p),Nconstituents,sizeState,sizeDotState,0) + call phase_allocateState(plasticState(ph),Nconstituents,sizeState,sizeDotState,0) !-------------------------------------------------------------------------------------------------- ! state aliases and initialization startIndex = 1 endIndex = prm%sum_N_sl - stt%rho_mob => plasticState(p)%state(startIndex:endIndex,:) + stt%rho_mob => plasticState(ph)%state(startIndex:endIndex,:) stt%rho_mob = spread(rho_mob_0,2,Nconstituents) - dot%rho_mob => plasticState(p)%dotState(startIndex:endIndex,:) - 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' + dot%rho_mob => plasticState(ph)%dotState(startIndex:endIndex,:) + plasticState(ph)%atol(startIndex:endIndex) = pl%get_asFloat('atol_rho',defaultVal=1.0_pReal) + if (any(plasticState(ph)%atol(startIndex:endIndex) < 0.0_pReal)) extmsg = trim(extmsg)//' atol_rho' startIndex = endIndex + 1 endIndex = endIndex + prm%sum_N_sl - stt%rho_dip => plasticState(p)%state(startIndex:endIndex,:) + stt%rho_dip => plasticState(ph)%state(startIndex:endIndex,:) stt%rho_dip = spread(rho_dip_0,2,Nconstituents) - dot%rho_dip => plasticState(p)%dotState(startIndex:endIndex,:) - plasticState(p)%atol(startIndex:endIndex) = pl%get_asFloat('atol_rho',defaultVal=1.0_pReal) + dot%rho_dip => plasticState(ph)%dotState(startIndex:endIndex,:) + plasticState(ph)%atol(startIndex:endIndex) = pl%get_asFloat('atol_rho',defaultVal=1.0_pReal) startIndex = endIndex + 1 endIndex = endIndex + prm%sum_N_sl - stt%gamma_sl => plasticState(p)%state(startIndex:endIndex,:) - dot%gamma_sl => plasticState(p)%dotState(startIndex:endIndex,:) - plasticState(p)%atol(startIndex:endIndex) = 1.0e-2_pReal + stt%gamma_sl => plasticState(ph)%state(startIndex:endIndex,:) + dot%gamma_sl => plasticState(ph)%dotState(startIndex:endIndex,:) + plasticState(ph)%atol(startIndex:endIndex) = 1.0e-2_pReal ! global alias - plasticState(p)%slipRate => plasticState(p)%dotState(startIndex:endIndex,:) + plasticState(ph)%slipRate => plasticState(ph)%dotState(startIndex:endIndex,:) allocate(dst%Lambda_sl(prm%sum_N_sl,Nconstituents), source=0.0_pReal) allocate(dst%threshold_stress(prm%sum_N_sl,Nconstituents), source=0.0_pReal) - plasticState(p)%state0 = plasticState(p)%state ! ToDo: this could be done centrally + plasticState(ph)%state0 = plasticState(ph)%state ! ToDo: this could be done centrally end associate diff --git a/src/phase_mechanical_plastic_dislotwin.f90 b/src/phase_mechanical_plastic_dislotwin.f90 index 3b33196d9..0c52176ce 100644 --- a/src/phase_mechanical_plastic_dislotwin.f90 +++ b/src/phase_mechanical_plastic_dislotwin.f90 @@ -126,7 +126,7 @@ module function plastic_dislotwin_init() result(myPlasticity) logical, dimension(:), allocatable :: myPlasticity integer :: & - p, i, & + ph, i, & Nconstituents, & sizeState, sizeDotState, & startIndex, endIndex @@ -167,15 +167,13 @@ module function plastic_dislotwin_init() result(myPlasticity) allocate(dependentState(phases%length)) - do p = 1, phases%length - if(.not. myPlasticity(p)) cycle - phase => phases%get(p) + do ph = 1, phases%length + if(.not. myPlasticity(ph)) cycle + + associate(prm => param(ph), dot => dotState(ph), stt => state(ph), dst => dependentState(ph)) + + phase => phases%get(ph) mech => phase%get('mechanics') - i = p - associate(prm => param(i), & - dot => dotState(i), & - stt => state(i), & - dst => dependentState(i)) pl => mech%get('plasticity') #if defined (__GFORTRAN__) @@ -185,9 +183,9 @@ module function plastic_dislotwin_init() result(myPlasticity) #endif ! This data is read in already in lattice - prm%mu = lattice_mu(p) - prm%nu = lattice_nu(p) - prm%C66 = lattice_C66(1:6,1:6,p) + prm%mu = lattice_mu(ph) + prm%nu = lattice_nu(ph) + prm%C66 = lattice_C66(1:6,1:6,ph) !-------------------------------------------------------------------------------------------------- ! slip related parameters @@ -204,8 +202,7 @@ module function plastic_dislotwin_init() result(myPlasticity) prm%n0_sl = lattice_slip_normal(N_sl,phase%get_asString('lattice'),& phase%get_asFloat('c/a',defaultVal=0.0_pReal)) - prm%fccTwinTransNucleation = merge(.true., .false., lattice_structure(p) == lattice_FCC_ID) & - .and. (N_sl(1) == 12) + prm%fccTwinTransNucleation = lattice_structure(ph) == lattice_FCC_ID .and. (N_sl(1) == 12) if(prm%fccTwinTransNucleation) prm%fcc_twinNucleationSlipPair = lattice_FCC_TWINNUCLEATIONSLIPPAIR rho_mob_0 = pl%get_asFloats('rho_mob_0', requiredSize=size(N_sl)) @@ -234,7 +231,7 @@ module function plastic_dislotwin_init() result(myPlasticity) ! multiplication factor according to crystal structure (nearest neighbors bcc vs fcc/hex) ! details: Argon & Moffat, Acta Metallurgica, Vol. 29, pg 293 to 299, 1981 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(ph) == [lattice_FCC_ID,lattice_HEX_ID])) ! expand: family => system rho_mob_0 = math_expand(rho_mob_0, N_sl) @@ -342,7 +339,7 @@ module function plastic_dislotwin_init() result(myPlasticity) pl%get_asFloat('a_cI', defaultVal=0.0_pReal), & pl%get_asFloat('a_cF', defaultVal=0.0_pReal)) - if (lattice_structure(p) /= lattice_FCC_ID) then + if (lattice_structure(ph) /= lattice_FCC_ID) then 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) endif @@ -357,7 +354,7 @@ module function plastic_dislotwin_init() result(myPlasticity) 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%s < 0.0_pReal)) extmsg = trim(extmsg)//' p_tr' - if (lattice_structure(p) /= lattice_FCC_ID) then + if (lattice_structure(ph) /= lattice_FCC_ID) then if (any(prm%dot_N_0_tr < 0.0_pReal)) extmsg = trim(extmsg)//' dot_N_0_tr' endif else transActive @@ -408,53 +405,53 @@ module function plastic_dislotwin_init() result(myPlasticity) !-------------------------------------------------------------------------------------------------- ! allocate state arrays - Nconstituents = count(material_phaseAt2 == p) + Nconstituents = count(material_phaseAt2 == ph) sizeDotState = size(['rho_mob ','rho_dip ','gamma_sl']) * prm%sum_N_sl & + size(['f_tw']) * prm%sum_N_tw & + size(['f_tr']) * prm%sum_N_tr sizeState = sizeDotState - call phase_allocateState(plasticState(p),Nconstituents,sizeState,sizeDotState,0) + call phase_allocateState(plasticState(ph),Nconstituents,sizeState,sizeDotState,0) !-------------------------------------------------------------------------------------------------- ! locally defined state aliases and initialization of state0 and atol startIndex = 1 endIndex = prm%sum_N_sl - stt%rho_mob=>plasticState(p)%state(startIndex:endIndex,:) + stt%rho_mob=>plasticState(ph)%state(startIndex:endIndex,:) stt%rho_mob= spread(rho_mob_0,2,Nconstituents) - dot%rho_mob=>plasticState(p)%dotState(startIndex:endIndex,:) - 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' + dot%rho_mob=>plasticState(ph)%dotState(startIndex:endIndex,:) + plasticState(ph)%atol(startIndex:endIndex) = pl%get_asFloat('atol_rho',defaultVal=1.0_pReal) + if (any(plasticState(ph)%atol(startIndex:endIndex) < 0.0_pReal)) extmsg = trim(extmsg)//' atol_rho' startIndex = endIndex + 1 endIndex = endIndex + prm%sum_N_sl - stt%rho_dip=>plasticState(p)%state(startIndex:endIndex,:) + stt%rho_dip=>plasticState(ph)%state(startIndex:endIndex,:) stt%rho_dip= spread(rho_dip_0,2,Nconstituents) - dot%rho_dip=>plasticState(p)%dotState(startIndex:endIndex,:) - plasticState(p)%atol(startIndex:endIndex) = pl%get_asFloat('atol_rho',defaultVal=1.0_pReal) + dot%rho_dip=>plasticState(ph)%dotState(startIndex:endIndex,:) + plasticState(ph)%atol(startIndex:endIndex) = pl%get_asFloat('atol_rho',defaultVal=1.0_pReal) startIndex = endIndex + 1 endIndex = endIndex + prm%sum_N_sl - stt%gamma_sl=>plasticState(p)%state(startIndex:endIndex,:) - dot%gamma_sl=>plasticState(p)%dotState(startIndex:endIndex,:) - plasticState(p)%atol(startIndex:endIndex) = 1.0e-2_pReal + stt%gamma_sl=>plasticState(ph)%state(startIndex:endIndex,:) + dot%gamma_sl=>plasticState(ph)%dotState(startIndex:endIndex,:) + plasticState(ph)%atol(startIndex:endIndex) = 1.0e-2_pReal ! global alias - plasticState(p)%slipRate => plasticState(p)%dotState(startIndex:endIndex,:) + plasticState(ph)%slipRate => plasticState(ph)%dotState(startIndex:endIndex,:) startIndex = endIndex + 1 endIndex = endIndex + prm%sum_N_tw - stt%f_tw=>plasticState(p)%state(startIndex:endIndex,:) - dot%f_tw=>plasticState(p)%dotState(startIndex:endIndex,:) - 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' + stt%f_tw=>plasticState(ph)%state(startIndex:endIndex,:) + dot%f_tw=>plasticState(ph)%dotState(startIndex:endIndex,:) + plasticState(ph)%atol(startIndex:endIndex) = pl%get_asFloat('f_twin',defaultVal=1.0e-7_pReal) + if (any(plasticState(ph)%atol(startIndex:endIndex) < 0.0_pReal)) extmsg = trim(extmsg)//' f_twin' startIndex = endIndex + 1 endIndex = endIndex + prm%sum_N_tr - stt%f_tr=>plasticState(p)%state(startIndex:endIndex,:) - dot%f_tr=>plasticState(p)%dotState(startIndex:endIndex,:) - 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' + stt%f_tr=>plasticState(ph)%state(startIndex:endIndex,:) + dot%f_tr=>plasticState(ph)%dotState(startIndex:endIndex,:) + plasticState(ph)%atol(startIndex:endIndex) = pl%get_asFloat('f_trans',defaultVal=1.0e-6_pReal) + if (any(plasticState(ph)%atol(startIndex:endIndex) < 0.0_pReal)) extmsg = trim(extmsg)//' f_trans' allocate(dst%Lambda_sl (prm%sum_N_sl,Nconstituents),source=0.0_pReal) allocate(dst%tau_pass (prm%sum_N_sl,Nconstituents),source=0.0_pReal) @@ -469,7 +466,7 @@ module function plastic_dislotwin_init() result(myPlasticity) allocate(dst%tau_r_tr (prm%sum_N_tr,Nconstituents),source=0.0_pReal) allocate(dst%V_tr (prm%sum_N_tr,Nconstituents),source=0.0_pReal) - plasticState(p)%state0 = plasticState(p)%state ! ToDo: this could be done centrally + plasticState(ph)%state0 = plasticState(ph)%state ! ToDo: this could be done centrally end associate diff --git a/src/phase_mechanical_plastic_isotropic.f90 b/src/phase_mechanical_plastic_isotropic.f90 index 39a4b3a7c..245f4293a 100644 --- a/src/phase_mechanical_plastic_isotropic.f90 +++ b/src/phase_mechanical_plastic_isotropic.f90 @@ -22,8 +22,6 @@ submodule(phase:plastic) isotropic c_4, & c_3, & c_2 - integer :: & - of_debug = 0 logical :: & dilatation character(len=pStringLen), allocatable, dimension(:) :: & @@ -53,8 +51,7 @@ module function plastic_isotropic_init() result(myPlasticity) logical, dimension(:), allocatable :: myPlasticity integer :: & - p, & - i, & + ph, & Nconstituents, & sizeState, sizeDotState real(pReal) :: & @@ -82,16 +79,14 @@ module function plastic_isotropic_init() result(myPlasticity) allocate(state(phases%length)) allocate(dotState(phases%length)) - do p = 1, phases%length - if(.not. myPlasticity(p)) cycle - phase => phases%get(p) - mech => phase%get('mechanics') - i = p - associate(prm => param(i), & - dot => dotState(i), & - stt => state(i)) - pl => mech%get('plasticity') + do ph = 1, phases%length + if(.not. myPlasticity(ph)) cycle + associate(prm => param(ph), dot => dotState(ph), stt => state(ph)) + + phase => phases%get(ph) + mech => phase%get('mechanics') + pl => mech%get('plasticity') #if defined (__GFORTRAN__) prm%output = output_asStrings(pl) @@ -99,11 +94,6 @@ module function plastic_isotropic_init() result(myPlasticity) prm%output = pl%get_asStrings('output',defaultVal=emptyStringArray) #endif -#ifdef DEBUG - if (p==material_phaseAt(debugConstitutive%grain,debugConstitutive%element)) & - prm%of_debug = material_phasememberAt(debugConstitutive%grain,debugConstitutive%ip,debugConstitutive%element) -#endif - xi_0 = pl%get_asFloat('xi_0') prm%xi_inf = pl%get_asFloat('xi_inf') prm%dot_gamma_0 = pl%get_asFloat('dot_gamma_0') @@ -129,28 +119,28 @@ module function plastic_isotropic_init() result(myPlasticity) !-------------------------------------------------------------------------------------------------- ! allocate state arrays - Nconstituents = count(material_phaseAt2 == p) + Nconstituents = count(material_phaseAt2 == ph) sizeDotState = size(['xi ','gamma']) sizeState = sizeDotState - call phase_allocateState(plasticState(p),Nconstituents,sizeState,sizeDotState,0) + call phase_allocateState(plasticState(ph),Nconstituents,sizeState,sizeDotState,0) !-------------------------------------------------------------------------------------------------- ! state aliases and initialization - stt%xi => plasticState(p)%state (1,:) + stt%xi => plasticState(ph)%state (1,:) stt%xi = xi_0 - dot%xi => plasticState(p)%dotState(1,:) - 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' + dot%xi => plasticState(ph)%dotState(1,:) + plasticState(ph)%atol(1) = pl%get_asFloat('atol_xi',defaultVal=1.0_pReal) + if (plasticState(ph)%atol(1) < 0.0_pReal) extmsg = trim(extmsg)//' atol_xi' - stt%gamma => plasticState(p)%state (2,:) - dot%gamma => plasticState(p)%dotState(2,:) - 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' + stt%gamma => plasticState(ph)%state (2,:) + dot%gamma => plasticState(ph)%dotState(2,:) + plasticState(ph)%atol(2) = pl%get_asFloat('atol_gamma',defaultVal=1.0e-6_pReal) + if (plasticState(ph)%atol(2) < 0.0_pReal) extmsg = trim(extmsg)//' atol_gamma' ! global alias - plasticState(p)%slipRate => plasticState(p)%dotState(2:2,:) + plasticState(ph)%slipRate => plasticState(ph)%dotState(2:2,:) - plasticState(p)%state0 = plasticState(p)%state ! ToDo: this could be done centrally + plasticState(ph)%state0 = plasticState(ph)%state ! ToDo: this could be done centrally end associate @@ -240,13 +230,11 @@ module subroutine plastic_isotropic_LiAndItsTangent(Li,dLi_dMi,Mi,ph,me) tr=math_trace33(math_spherical33(Mi)) - if (prm%dilatation .and. abs(tr) > 0.0_pReal) then ! no stress or J2 plasticity --> Li and its derivative are zero + if (prm%dilatation .and. abs(tr) > 0.0_pReal) then ! no stress or J2 plasticity --> Li and its derivative are zero Li = math_I3 & * prm%dot_gamma_0/prm%M * (3.0_pReal*prm%M*stt%xi(me))**(-prm%n) & * tr * abs(tr)**(prm%n-1.0_pReal) - forall (k=1:3,l=1:3,m=1:3,n=1:3) dLi_dMi(k,l,m,n) = prm%n / tr * Li(k,l) * math_I3(m,n) - else Li = 0.0_pReal dLi_dMi = 0.0_pReal diff --git a/src/phase_mechanical_plastic_kinehardening.f90 b/src/phase_mechanical_plastic_kinehardening.f90 index 14aa58fb9..8acf42710 100644 --- a/src/phase_mechanical_plastic_kinehardening.f90 +++ b/src/phase_mechanical_plastic_kinehardening.f90 @@ -25,8 +25,7 @@ submodule(phase:plastic) kinehardening nonSchmid_pos, & nonSchmid_neg integer :: & - sum_N_sl, & !< total number of active slip system - of_debug = 0 + sum_N_sl logical :: & nonSchmidActive = .false. character(len=pStringLen), allocatable, dimension(:) :: & @@ -62,7 +61,7 @@ module function plastic_kinehardening_init() result(myPlasticity) logical, dimension(:), allocatable :: myPlasticity integer :: & - p, i, o, & + ph, o, & Nconstituents, & sizeState, sizeDeltaState, sizeDotState, & startIndex, endIndex @@ -93,15 +92,13 @@ module function plastic_kinehardening_init() result(myPlasticity) allocate(deltaState(phases%length)) - do p = 1, phases%length - if(.not. myPlasticity(p)) cycle - phase => phases%get(p) + do ph = 1, phases%length + if(.not. myPlasticity(ph)) cycle + + associate(prm => param(ph), dot => dotState(ph), dlt => deltaState(ph), stt => state(ph)) + + phase => phases%get(ph) mech => phase%get('mechanics') - i = p - associate(prm => param(i), & - dot => dotState(i), & - dlt => deltaState(i), & - stt => state(i)) pl => mech%get('plasticity') #if defined (__GFORTRAN__) @@ -110,12 +107,6 @@ module function plastic_kinehardening_init() result(myPlasticity) prm%output = pl%get_asStrings('output',defaultVal=emptyStringArray) #endif -#ifdef DEBUG - if (p==material_phaseAt(debugConstitutive%grain,debugConstitutive%element)) then - prm%of_debug = material_phasememberAt(debugConstitutive%grain,debugConstitutive%ip,debugConstitutive%element) - endif -#endif - !-------------------------------------------------------------------------------------------------- ! slip related parameters N_sl = pl%get_asInts('N_sl',defaultVal=emptyIntArray) @@ -174,55 +165,55 @@ module function plastic_kinehardening_init() result(myPlasticity) !-------------------------------------------------------------------------------------------------- ! allocate state arrays - Nconstituents = count(material_phaseAt2 == p) - sizeDotState = size(['crss ','crss_back', 'accshear ']) * prm%sum_N_sl!ToDo: adjust names, ask Philip - sizeDeltaState = size(['sense ', 'chi0 ', 'gamma0' ]) * prm%sum_N_sl !ToDo: adjust names + Nconstituents = count(material_phaseAt2 == ph) + sizeDotState = size(['crss ','crss_back', 'accshear ']) * prm%sum_N_sl !ToDo: adjust names like in material.yaml + sizeDeltaState = size(['sense ', 'chi0 ', 'gamma0' ]) * prm%sum_N_sl !ToDo: adjust names like in material.yaml sizeState = sizeDotState + sizeDeltaState - call phase_allocateState(plasticState(p),Nconstituents,sizeState,sizeDotState,sizeDeltaState) + call phase_allocateState(plasticState(ph),Nconstituents,sizeState,sizeDotState,sizeDeltaState) !-------------------------------------------------------------------------------------------------- ! state aliases and initialization startIndex = 1 endIndex = prm%sum_N_sl - stt%crss => plasticState(p)%state (startIndex:endIndex,:) + stt%crss => plasticState(ph)%state (startIndex:endIndex,:) stt%crss = spread(xi_0, 2, Nconstituents) - dot%crss => plasticState(p)%dotState(startIndex:endIndex,:) - 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' + dot%crss => plasticState(ph)%dotState(startIndex:endIndex,:) + plasticState(ph)%atol(startIndex:endIndex) = pl%get_asFloat('atol_xi',defaultVal=1.0_pReal) + if(any(plasticState(ph)%atol(startIndex:endIndex) < 0.0_pReal)) extmsg = trim(extmsg)//' atol_xi' startIndex = endIndex + 1 endIndex = endIndex + prm%sum_N_sl - stt%crss_back => plasticState(p)%state (startIndex:endIndex,:) - dot%crss_back => plasticState(p)%dotState(startIndex:endIndex,:) - plasticState(p)%atol(startIndex:endIndex) = pl%get_asFloat('atol_xi',defaultVal=1.0_pReal) + stt%crss_back => plasticState(ph)%state (startIndex:endIndex,:) + dot%crss_back => plasticState(ph)%dotState(startIndex:endIndex,:) + plasticState(ph)%atol(startIndex:endIndex) = pl%get_asFloat('atol_xi',defaultVal=1.0_pReal) startIndex = endIndex + 1 endIndex = endIndex + prm%sum_N_sl - stt%accshear => plasticState(p)%state (startIndex:endIndex,:) - dot%accshear => plasticState(p)%dotState(startIndex:endIndex,:) - 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' + stt%accshear => plasticState(ph)%state (startIndex:endIndex,:) + dot%accshear => plasticState(ph)%dotState(startIndex:endIndex,:) + plasticState(ph)%atol(startIndex:endIndex) = pl%get_asFloat('atol_gamma',defaultVal=1.0e-6_pReal) + if(any(plasticState(ph)%atol(startIndex:endIndex) < 0.0_pReal)) extmsg = trim(extmsg)//' atol_gamma' ! global alias - plasticState(p)%slipRate => plasticState(p)%dotState(startIndex:endIndex,:) + plasticState(ph)%slipRate => plasticState(ph)%dotState(startIndex:endIndex,:) - o = plasticState(p)%offsetDeltaState + o = plasticState(ph)%offsetDeltaState startIndex = endIndex + 1 endIndex = endIndex + prm%sum_N_sl - stt%sense => plasticState(p)%state (startIndex :endIndex ,:) - dlt%sense => plasticState(p)%deltaState(startIndex-o:endIndex-o,:) + stt%sense => plasticState(ph)%state (startIndex :endIndex ,:) + dlt%sense => plasticState(ph)%deltaState(startIndex-o:endIndex-o,:) startIndex = endIndex + 1 endIndex = endIndex + prm%sum_N_sl - stt%chi0 => plasticState(p)%state (startIndex :endIndex ,:) - dlt%chi0 => plasticState(p)%deltaState(startIndex-o:endIndex-o,:) + stt%chi0 => plasticState(ph)%state (startIndex :endIndex ,:) + dlt%chi0 => plasticState(ph)%deltaState(startIndex-o:endIndex-o,:) startIndex = endIndex + 1 endIndex = endIndex + prm%sum_N_sl - stt%gamma0 => plasticState(p)%state (startIndex :endIndex ,:) - dlt%gamma0 => plasticState(p)%deltaState(startIndex-o:endIndex-o,:) + stt%gamma0 => plasticState(ph)%state (startIndex :endIndex ,:) + dlt%gamma0 => plasticState(ph)%deltaState(startIndex-o:endIndex-o,:) - plasticState(p)%state0 = plasticState(p)%state ! ToDo: this could be done centrally + plasticState(ph)%state0 = plasticState(ph)%state ! ToDo: this could be done centrally end associate diff --git a/src/phase_mechanical_plastic_none.f90 b/src/phase_mechanical_plastic_none.f90 index 1510262cc..28e9fbc7c 100644 --- a/src/phase_mechanical_plastic_none.f90 +++ b/src/phase_mechanical_plastic_none.f90 @@ -16,8 +16,7 @@ module function plastic_none_init() result(myPlasticity) logical, dimension(:), allocatable :: myPlasticity integer :: & - p, & - Nconstituents + ph class(tNode), pointer :: & phases @@ -29,10 +28,9 @@ module function plastic_none_init() result(myPlasticity) print'(a,i0)', ' # phases: ',count(myPlasticity); flush(IO_STDOUT) phases => config_material%get('phase') - do p = 1, phases%length - if(.not. myPlasticity(p)) cycle - Nconstituents = count(material_phaseAt2 == p) - call phase_allocateState(plasticState(p),Nconstituents,0,0,0) + do ph = 1, phases%length + if(.not. myPlasticity(ph)) cycle + call phase_allocateState(plasticState(ph),count(material_phaseAt2 == ph),0,0,0) enddo end function plastic_none_init diff --git a/src/phase_mechanical_plastic_nonlocal.f90 b/src/phase_mechanical_plastic_nonlocal.f90 index 0212baee8..fbfcfa5af 100644 --- a/src/phase_mechanical_plastic_nonlocal.f90 +++ b/src/phase_mechanical_plastic_nonlocal.f90 @@ -176,7 +176,7 @@ module function plastic_nonlocal_init() result(myPlasticity) logical, dimension(:), allocatable :: myPlasticity integer :: & Ninstances, & - p, i, & + ph, & Nconstituents, & sizeState, sizeDotState, sizeDependentState, sizeDeltaState, & s1, s2, & @@ -220,21 +220,17 @@ module function plastic_nonlocal_init() result(myPlasticity) allocate(deltaState(phases%length)) allocate(microstructure(phases%length)) - do p = 1, phases%length - if(.not. myPlasticity(p)) cycle - phase => phases%get(p) - mech => phase%get('mechanics') + do ph = 1, phases%length + if(.not. myPlasticity(ph)) cycle - i = p - associate(prm => param(i), & - dot => dotState(i), & - stt => state(i), & - st0 => state0(i), & - del => deltaState(i), & - dst => microstructure(i)) + associate(prm => param(ph), dot => dotState(ph), stt => state(ph), & + st0 => state0(ph), del => deltaState(ph), dst => microstructure(ph)) + + phase => phases%get(ph) + mech => phase%get('mechanics') pl => mech%get('plasticity') - phase_localPlasticity(p) = .not. pl%contains('nonlocal') + phase_localPlasticity(ph) = .not. pl%contains('nonlocal') #if defined (__GFORTRAN__) prm%output = output_asStrings(pl) @@ -245,8 +241,8 @@ module function plastic_nonlocal_init() result(myPlasticity) prm%atol_rho = pl%get_asFloat('atol_rho',defaultVal=1.0e4_pReal) ! This data is read in already in lattice - prm%mu = lattice_mu(p) - prm%nu = lattice_nu(p) + prm%mu = lattice_mu(ph) + prm%nu = lattice_nu(ph) ini%N_sl = pl%get_asInts('N_sl',defaultVal=emptyIntArray) prm%sum_N_sl = sum(abs(ini%N_sl)) @@ -402,7 +398,7 @@ module function plastic_nonlocal_init() result(myPlasticity) !-------------------------------------------------------------------------------------------------- ! allocate state arrays - Nconstituents = count(material_phaseAt2 == p) + Nconstituents = count(material_phaseAt2 == ph) sizeDotState = size([ 'rhoSglEdgePosMobile ','rhoSglEdgeNegMobile ', & 'rhoSglScrewPosMobile ','rhoSglScrewNegMobile ', & 'rhoSglEdgePosImmobile ','rhoSglEdgeNegImmobile ', & @@ -416,101 +412,101 @@ module function plastic_nonlocal_init() result(myPlasticity) 'maxDipoleHeightEdge ','maxDipoleHeightScrew' ]) * prm%sum_N_sl !< other dependent state variables that are not updated by microstructure sizeDeltaState = sizeDotState - call phase_allocateState(plasticState(p),Nconstituents,sizeState,sizeDotState,sizeDeltaState) + call phase_allocateState(plasticState(ph),Nconstituents,sizeState,sizeDotState,sizeDeltaState) - allocate(geom(p)%V_0(Nconstituents)) - call storeGeometry(p) + allocate(geom(ph)%V_0(Nconstituents)) + call storeGeometry(ph) - plasticState(p)%nonlocal = pl%get_asBool('nonlocal') - if(plasticState(p)%nonlocal .and. .not. allocated(IPneighborhood)) & + plasticState(ph)%nonlocal = pl%get_asBool('nonlocal') + if(plasticState(ph)%nonlocal .and. .not. allocated(IPneighborhood)) & call IO_error(212,ext_msg='IPneighborhood does not exist') - plasticState(p)%offsetDeltaState = 0 ! ToDo: state structure does not follow convention + plasticState(ph)%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,:) - stt%rho => plasticState(p)%state (0*prm%sum_N_sl+1:10*prm%sum_N_sl,:) - dot%rho => plasticState(p)%dotState (0*prm%sum_N_sl+1:10*prm%sum_N_sl,:) - del%rho => plasticState(p)%deltaState (0*prm%sum_N_sl+1:10*prm%sum_N_sl,:) - plasticState(p)%atol(1:10*prm%sum_N_sl) = prm%atol_rho + st0%rho => plasticState(ph)%state0 (0*prm%sum_N_sl+1:10*prm%sum_N_sl,:) + stt%rho => plasticState(ph)%state (0*prm%sum_N_sl+1:10*prm%sum_N_sl,:) + dot%rho => plasticState(ph)%dotState (0*prm%sum_N_sl+1:10*prm%sum_N_sl,:) + del%rho => plasticState(ph)%deltaState (0*prm%sum_N_sl+1:10*prm%sum_N_sl,:) + plasticState(ph)%atol(1:10*prm%sum_N_sl) = prm%atol_rho - stt%rhoSgl => plasticState(p)%state (0*prm%sum_N_sl+1: 8*prm%sum_N_sl,:) - dot%rhoSgl => plasticState(p)%dotState (0*prm%sum_N_sl+1: 8*prm%sum_N_sl,:) - del%rhoSgl => plasticState(p)%deltaState (0*prm%sum_N_sl+1: 8*prm%sum_N_sl,:) + stt%rhoSgl => plasticState(ph)%state (0*prm%sum_N_sl+1: 8*prm%sum_N_sl,:) + dot%rhoSgl => plasticState(ph)%dotState (0*prm%sum_N_sl+1: 8*prm%sum_N_sl,:) + del%rhoSgl => plasticState(ph)%deltaState (0*prm%sum_N_sl+1: 8*prm%sum_N_sl,:) - stt%rhoSglMobile => plasticState(p)%state (0*prm%sum_N_sl+1: 4*prm%sum_N_sl,:) - dot%rhoSglMobile => plasticState(p)%dotState (0*prm%sum_N_sl+1: 4*prm%sum_N_sl,:) - del%rhoSglMobile => plasticState(p)%deltaState (0*prm%sum_N_sl+1: 4*prm%sum_N_sl,:) + stt%rhoSglMobile => plasticState(ph)%state (0*prm%sum_N_sl+1: 4*prm%sum_N_sl,:) + dot%rhoSglMobile => plasticState(ph)%dotState (0*prm%sum_N_sl+1: 4*prm%sum_N_sl,:) + del%rhoSglMobile => plasticState(ph)%deltaState (0*prm%sum_N_sl+1: 4*prm%sum_N_sl,:) - stt%rho_sgl_mob_edg_pos => plasticState(p)%state (0*prm%sum_N_sl+1: 1*prm%sum_N_sl,:) - dot%rho_sgl_mob_edg_pos => plasticState(p)%dotState (0*prm%sum_N_sl+1: 1*prm%sum_N_sl,:) - del%rho_sgl_mob_edg_pos => plasticState(p)%deltaState (0*prm%sum_N_sl+1: 1*prm%sum_N_sl,:) + stt%rho_sgl_mob_edg_pos => plasticState(ph)%state (0*prm%sum_N_sl+1: 1*prm%sum_N_sl,:) + dot%rho_sgl_mob_edg_pos => plasticState(ph)%dotState (0*prm%sum_N_sl+1: 1*prm%sum_N_sl,:) + del%rho_sgl_mob_edg_pos => plasticState(ph)%deltaState (0*prm%sum_N_sl+1: 1*prm%sum_N_sl,:) - stt%rho_sgl_mob_edg_neg => plasticState(p)%state (1*prm%sum_N_sl+1: 2*prm%sum_N_sl,:) - dot%rho_sgl_mob_edg_neg => plasticState(p)%dotState (1*prm%sum_N_sl+1: 2*prm%sum_N_sl,:) - del%rho_sgl_mob_edg_neg => plasticState(p)%deltaState (1*prm%sum_N_sl+1: 2*prm%sum_N_sl,:) + stt%rho_sgl_mob_edg_neg => plasticState(ph)%state (1*prm%sum_N_sl+1: 2*prm%sum_N_sl,:) + dot%rho_sgl_mob_edg_neg => plasticState(ph)%dotState (1*prm%sum_N_sl+1: 2*prm%sum_N_sl,:) + del%rho_sgl_mob_edg_neg => plasticState(ph)%deltaState (1*prm%sum_N_sl+1: 2*prm%sum_N_sl,:) - stt%rho_sgl_mob_scr_pos => plasticState(p)%state (2*prm%sum_N_sl+1: 3*prm%sum_N_sl,:) - dot%rho_sgl_mob_scr_pos => plasticState(p)%dotState (2*prm%sum_N_sl+1: 3*prm%sum_N_sl,:) - del%rho_sgl_mob_scr_pos => plasticState(p)%deltaState (2*prm%sum_N_sl+1: 3*prm%sum_N_sl,:) + stt%rho_sgl_mob_scr_pos => plasticState(ph)%state (2*prm%sum_N_sl+1: 3*prm%sum_N_sl,:) + dot%rho_sgl_mob_scr_pos => plasticState(ph)%dotState (2*prm%sum_N_sl+1: 3*prm%sum_N_sl,:) + del%rho_sgl_mob_scr_pos => plasticState(ph)%deltaState (2*prm%sum_N_sl+1: 3*prm%sum_N_sl,:) - stt%rho_sgl_mob_scr_neg => plasticState(p)%state (3*prm%sum_N_sl+1: 4*prm%sum_N_sl,:) - dot%rho_sgl_mob_scr_neg => plasticState(p)%dotState (3*prm%sum_N_sl+1: 4*prm%sum_N_sl,:) - del%rho_sgl_mob_scr_neg => plasticState(p)%deltaState (3*prm%sum_N_sl+1: 4*prm%sum_N_sl,:) + stt%rho_sgl_mob_scr_neg => plasticState(ph)%state (3*prm%sum_N_sl+1: 4*prm%sum_N_sl,:) + dot%rho_sgl_mob_scr_neg => plasticState(ph)%dotState (3*prm%sum_N_sl+1: 4*prm%sum_N_sl,:) + del%rho_sgl_mob_scr_neg => plasticState(ph)%deltaState (3*prm%sum_N_sl+1: 4*prm%sum_N_sl,:) - stt%rhoSglImmobile => plasticState(p)%state (4*prm%sum_N_sl+1: 8*prm%sum_N_sl,:) - dot%rhoSglImmobile => plasticState(p)%dotState (4*prm%sum_N_sl+1: 8*prm%sum_N_sl,:) - del%rhoSglImmobile => plasticState(p)%deltaState (4*prm%sum_N_sl+1: 8*prm%sum_N_sl,:) + stt%rhoSglImmobile => plasticState(ph)%state (4*prm%sum_N_sl+1: 8*prm%sum_N_sl,:) + dot%rhoSglImmobile => plasticState(ph)%dotState (4*prm%sum_N_sl+1: 8*prm%sum_N_sl,:) + del%rhoSglImmobile => plasticState(ph)%deltaState (4*prm%sum_N_sl+1: 8*prm%sum_N_sl,:) - stt%rho_sgl_imm_edg_pos => plasticState(p)%state (4*prm%sum_N_sl+1: 5*prm%sum_N_sl,:) - dot%rho_sgl_imm_edg_pos => plasticState(p)%dotState (4*prm%sum_N_sl+1: 5*prm%sum_N_sl,:) - del%rho_sgl_imm_edg_pos => plasticState(p)%deltaState (4*prm%sum_N_sl+1: 5*prm%sum_N_sl,:) + stt%rho_sgl_imm_edg_pos => plasticState(ph)%state (4*prm%sum_N_sl+1: 5*prm%sum_N_sl,:) + dot%rho_sgl_imm_edg_pos => plasticState(ph)%dotState (4*prm%sum_N_sl+1: 5*prm%sum_N_sl,:) + del%rho_sgl_imm_edg_pos => plasticState(ph)%deltaState (4*prm%sum_N_sl+1: 5*prm%sum_N_sl,:) - stt%rho_sgl_imm_edg_neg => plasticState(p)%state (5*prm%sum_N_sl+1: 6*prm%sum_N_sl,:) - dot%rho_sgl_imm_edg_neg => plasticState(p)%dotState (5*prm%sum_N_sl+1: 6*prm%sum_N_sl,:) - del%rho_sgl_imm_edg_neg => plasticState(p)%deltaState (5*prm%sum_N_sl+1: 6*prm%sum_N_sl,:) + stt%rho_sgl_imm_edg_neg => plasticState(ph)%state (5*prm%sum_N_sl+1: 6*prm%sum_N_sl,:) + dot%rho_sgl_imm_edg_neg => plasticState(ph)%dotState (5*prm%sum_N_sl+1: 6*prm%sum_N_sl,:) + del%rho_sgl_imm_edg_neg => plasticState(ph)%deltaState (5*prm%sum_N_sl+1: 6*prm%sum_N_sl,:) - stt%rho_sgl_imm_scr_pos => plasticState(p)%state (6*prm%sum_N_sl+1: 7*prm%sum_N_sl,:) - dot%rho_sgl_imm_scr_pos => plasticState(p)%dotState (6*prm%sum_N_sl+1: 7*prm%sum_N_sl,:) - del%rho_sgl_imm_scr_pos => plasticState(p)%deltaState (6*prm%sum_N_sl+1: 7*prm%sum_N_sl,:) + stt%rho_sgl_imm_scr_pos => plasticState(ph)%state (6*prm%sum_N_sl+1: 7*prm%sum_N_sl,:) + dot%rho_sgl_imm_scr_pos => plasticState(ph)%dotState (6*prm%sum_N_sl+1: 7*prm%sum_N_sl,:) + del%rho_sgl_imm_scr_pos => plasticState(ph)%deltaState (6*prm%sum_N_sl+1: 7*prm%sum_N_sl,:) - stt%rho_sgl_imm_scr_neg => plasticState(p)%state (7*prm%sum_N_sl+1: 8*prm%sum_N_sl,:) - dot%rho_sgl_imm_scr_neg => plasticState(p)%dotState (7*prm%sum_N_sl+1: 8*prm%sum_N_sl,:) - del%rho_sgl_imm_scr_neg => plasticState(p)%deltaState (7*prm%sum_N_sl+1: 8*prm%sum_N_sl,:) + stt%rho_sgl_imm_scr_neg => plasticState(ph)%state (7*prm%sum_N_sl+1: 8*prm%sum_N_sl,:) + dot%rho_sgl_imm_scr_neg => plasticState(ph)%dotState (7*prm%sum_N_sl+1: 8*prm%sum_N_sl,:) + del%rho_sgl_imm_scr_neg => plasticState(ph)%deltaState (7*prm%sum_N_sl+1: 8*prm%sum_N_sl,:) - stt%rhoDip => plasticState(p)%state (8*prm%sum_N_sl+1:10*prm%sum_N_sl,:) - dot%rhoDip => plasticState(p)%dotState (8*prm%sum_N_sl+1:10*prm%sum_N_sl,:) - del%rhoDip => plasticState(p)%deltaState (8*prm%sum_N_sl+1:10*prm%sum_N_sl,:) + stt%rhoDip => plasticState(ph)%state (8*prm%sum_N_sl+1:10*prm%sum_N_sl,:) + dot%rhoDip => plasticState(ph)%dotState (8*prm%sum_N_sl+1:10*prm%sum_N_sl,:) + del%rhoDip => plasticState(ph)%deltaState (8*prm%sum_N_sl+1:10*prm%sum_N_sl,:) - stt%rho_dip_edg => plasticState(p)%state (8*prm%sum_N_sl+1: 9*prm%sum_N_sl,:) - dot%rho_dip_edg => plasticState(p)%dotState (8*prm%sum_N_sl+1: 9*prm%sum_N_sl,:) - del%rho_dip_edg => plasticState(p)%deltaState (8*prm%sum_N_sl+1: 9*prm%sum_N_sl,:) + stt%rho_dip_edg => plasticState(ph)%state (8*prm%sum_N_sl+1: 9*prm%sum_N_sl,:) + dot%rho_dip_edg => plasticState(ph)%dotState (8*prm%sum_N_sl+1: 9*prm%sum_N_sl,:) + del%rho_dip_edg => plasticState(ph)%deltaState (8*prm%sum_N_sl+1: 9*prm%sum_N_sl,:) - stt%rho_dip_scr => plasticState(p)%state (9*prm%sum_N_sl+1:10*prm%sum_N_sl,:) - dot%rho_dip_scr => plasticState(p)%dotState (9*prm%sum_N_sl+1:10*prm%sum_N_sl,:) - del%rho_dip_scr => plasticState(p)%deltaState (9*prm%sum_N_sl+1:10*prm%sum_N_sl,:) + stt%rho_dip_scr => plasticState(ph)%state (9*prm%sum_N_sl+1:10*prm%sum_N_sl,:) + dot%rho_dip_scr => plasticState(ph)%dotState (9*prm%sum_N_sl+1:10*prm%sum_N_sl,:) + del%rho_dip_scr => plasticState(ph)%deltaState (9*prm%sum_N_sl+1:10*prm%sum_N_sl,:) - stt%gamma => plasticState(p)%state (10*prm%sum_N_sl + 1:11*prm%sum_N_sl,1:Nconstituents) - dot%gamma => plasticState(p)%dotState (10*prm%sum_N_sl + 1:11*prm%sum_N_sl,1:Nconstituents) - del%gamma => plasticState(p)%deltaState (10*prm%sum_N_sl + 1:11*prm%sum_N_sl,1:Nconstituents) - 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)) & + stt%gamma => plasticState(ph)%state (10*prm%sum_N_sl + 1:11*prm%sum_N_sl,1:Nconstituents) + dot%gamma => plasticState(ph)%dotState (10*prm%sum_N_sl + 1:11*prm%sum_N_sl,1:Nconstituents) + del%gamma => plasticState(ph)%deltaState (10*prm%sum_N_sl + 1:11*prm%sum_N_sl,1:Nconstituents) + plasticState(ph)%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(ph)%atol(10*prm%sum_N_sl+1:11*prm%sum_N_sl) < 0.0_pReal)) & extmsg = trim(extmsg)//' atol_gamma' - plasticState(p)%slipRate => plasticState(p)%dotState (10*prm%sum_N_sl + 1:11*prm%sum_N_sl,1:Nconstituents) + plasticState(ph)%slipRate => plasticState(ph)%dotState (10*prm%sum_N_sl + 1:11*prm%sum_N_sl,1:Nconstituents) - stt%rho_forest => plasticState(p)%state (11*prm%sum_N_sl + 1:12*prm%sum_N_sl,1:Nconstituents) - stt%v => plasticState(p)%state (12*prm%sum_N_sl + 1:16*prm%sum_N_sl,1:Nconstituents) - stt%v_edg_pos => plasticState(p)%state (12*prm%sum_N_sl + 1:13*prm%sum_N_sl,1:Nconstituents) - stt%v_edg_neg => plasticState(p)%state (13*prm%sum_N_sl + 1:14*prm%sum_N_sl,1:Nconstituents) - stt%v_scr_pos => plasticState(p)%state (14*prm%sum_N_sl + 1:15*prm%sum_N_sl,1:Nconstituents) - stt%v_scr_neg => plasticState(p)%state (15*prm%sum_N_sl + 1:16*prm%sum_N_sl,1:Nconstituents) + stt%rho_forest => plasticState(ph)%state (11*prm%sum_N_sl + 1:12*prm%sum_N_sl,1:Nconstituents) + stt%v => plasticState(ph)%state (12*prm%sum_N_sl + 1:16*prm%sum_N_sl,1:Nconstituents) + stt%v_edg_pos => plasticState(ph)%state (12*prm%sum_N_sl + 1:13*prm%sum_N_sl,1:Nconstituents) + stt%v_edg_neg => plasticState(ph)%state (13*prm%sum_N_sl + 1:14*prm%sum_N_sl,1:Nconstituents) + stt%v_scr_pos => plasticState(ph)%state (14*prm%sum_N_sl + 1:15*prm%sum_N_sl,1:Nconstituents) + stt%v_scr_neg => plasticState(ph)%state (15*prm%sum_N_sl + 1:16*prm%sum_N_sl,1:Nconstituents) allocate(dst%tau_pass(prm%sum_N_sl,Nconstituents),source=0.0_pReal) allocate(dst%tau_back(prm%sum_N_sl,Nconstituents),source=0.0_pReal) end associate - if (Nconstituents > 0) call stateInit(ini,p,Nconstituents) - plasticState(p)%state0 = plasticState(p)%state + if (Nconstituents > 0) call stateInit(ini,ph,Nconstituents) + plasticState(ph)%state0 = plasticState(ph)%state !-------------------------------------------------------------------------------------------------- ! exit if any parameter is out of range @@ -526,35 +522,34 @@ module function plastic_nonlocal_init() result(myPlasticity) allocate(iV(maxval(param%sum_N_sl),4,phases%length), source=0) allocate(iD(maxval(param%sum_N_sl),2,phases%length), source=0) - do p = 1, phases%length - phase => phases%get(p) + do ph = 1, phases%length - if(.not. myPlasticity(p)) cycle - i = p + if(.not. myPlasticity(ph)) cycle - Nconstituents = count(material_phaseAt2 == p) + phase => phases%get(ph) + Nconstituents = count(material_phaseAt2 == ph) l = 0 do t = 1,4 - do s = 1,param(i)%sum_N_sl + do s = 1,param(ph)%sum_N_sl l = l + 1 - iRhoU(s,t,i) = l + iRhoU(s,t,ph) = l enddo enddo - l = l + (4+2+1+1)*param(i)%sum_N_sl ! immobile(4), dipole(2), shear, forest + l = l + (4+2+1+1)*param(ph)%sum_N_sl ! immobile(4), dipole(2), shear, forest do t = 1,4 - do s = 1,param(i)%sum_N_sl + do s = 1,param(ph)%sum_N_sl l = l + 1 - iV(s,t,i) = l + iV(s,t,ph) = l enddo enddo do t = 1,2 - do s = 1,param(i)%sum_N_sl + do s = 1,param(ph)%sum_N_sl l = l + 1 - iD(s,t,i) = l + iD(s,t,ph) = 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)') + if (iD(param(ph)%sum_N_sl,2,ph) /= plasticState(ph)%sizeState) & + error stop 'state indices not properly set (nonlocal)' enddo end function plastic_nonlocal_init diff --git a/src/phase_mechanical_plastic_phenopowerlaw.f90 b/src/phase_mechanical_plastic_phenopowerlaw.f90 index 94214f14a..d769431b4 100644 --- a/src/phase_mechanical_plastic_phenopowerlaw.f90 +++ b/src/phase_mechanical_plastic_phenopowerlaw.f90 @@ -70,7 +70,7 @@ module function plastic_phenopowerlaw_init() result(myPlasticity) logical, dimension(:), allocatable :: myPlasticity integer :: & - p, i, & + ph, i, & Nconstituents, & sizeState, sizeDotState, & startIndex, endIndex @@ -101,14 +101,13 @@ module function plastic_phenopowerlaw_init() result(myPlasticity) allocate(state(phases%length)) allocate(dotState(phases%length)) - do p = 1, phases%length - if(.not. myPlasticity(p)) cycle - phase => phases%get(p) + do ph = 1, phases%length + if(.not. myPlasticity(ph)) cycle + + associate(prm => param(ph), dot => dotState(ph), stt => state(ph)) + + phase => phases%get(ph) mech => phase%get('mechanics') - i = p - associate(prm => param(i), & - dot => dotState(i), & - stt => state(i)) pl => mech%get('plasticity') !-------------------------------------------------------------------------------------------------- @@ -135,7 +134,7 @@ module function plastic_phenopowerlaw_init() result(myPlasticity) xi_0_sl = pl%get_asFloats('xi_0_sl', requiredSize=size(N_sl)) prm%xi_inf_sl = pl%get_asFloats('xi_inf_sl', 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%dot_gamma_0_sl = pl%get_asFloat('dot_gamma_0_sl') prm%n_sl = pl%get_asFloat('n_sl') @@ -224,49 +223,49 @@ module function plastic_phenopowerlaw_init() result(myPlasticity) !-------------------------------------------------------------------------------------------------- ! allocate state arrays - Nconstituents = count(material_phaseAt2 == p) + Nconstituents = count(material_phaseAt2 == ph) sizeDotState = size(['xi_sl ','gamma_sl']) * prm%sum_N_sl & + size(['xi_tw ','gamma_tw']) * prm%sum_N_tw sizeState = sizeDotState - call phase_allocateState(plasticState(p),Nconstituents,sizeState,sizeDotState,0) + call phase_allocateState(plasticState(ph),Nconstituents,sizeState,sizeDotState,0) !-------------------------------------------------------------------------------------------------- ! state aliases and initialization startIndex = 1 endIndex = prm%sum_N_sl - stt%xi_slip => plasticState(p)%state (startIndex:endIndex,:) + stt%xi_slip => plasticState(ph)%state (startIndex:endIndex,:) stt%xi_slip = spread(xi_0_sl, 2, Nconstituents) - dot%xi_slip => plasticState(p)%dotState(startIndex:endIndex,:) - 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' + dot%xi_slip => plasticState(ph)%dotState(startIndex:endIndex,:) + plasticState(ph)%atol(startIndex:endIndex) = pl%get_asFloat('atol_xi',defaultVal=1.0_pReal) + if(any(plasticState(ph)%atol(startIndex:endIndex) < 0.0_pReal)) extmsg = trim(extmsg)//' atol_xi' startIndex = endIndex + 1 endIndex = endIndex + prm%sum_N_tw - stt%xi_twin => plasticState(p)%state (startIndex:endIndex,:) + stt%xi_twin => plasticState(ph)%state (startIndex:endIndex,:) stt%xi_twin = spread(xi_0_tw, 2, Nconstituents) - dot%xi_twin => plasticState(p)%dotState(startIndex:endIndex,:) - 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' + dot%xi_twin => plasticState(ph)%dotState(startIndex:endIndex,:) + plasticState(ph)%atol(startIndex:endIndex) = pl%get_asFloat('atol_xi',defaultVal=1.0_pReal) + if(any(plasticState(ph)%atol(startIndex:endIndex) < 0.0_pReal)) extmsg = trim(extmsg)//' atol_xi' startIndex = endIndex + 1 endIndex = endIndex + prm%sum_N_sl - stt%gamma_slip => plasticState(p)%state (startIndex:endIndex,:) - dot%gamma_slip => plasticState(p)%dotState(startIndex:endIndex,:) - 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' + stt%gamma_slip => plasticState(ph)%state (startIndex:endIndex,:) + dot%gamma_slip => plasticState(ph)%dotState(startIndex:endIndex,:) + plasticState(ph)%atol(startIndex:endIndex) = pl%get_asFloat('atol_gamma',defaultVal=1.0e-6_pReal) + if(any(plasticState(ph)%atol(startIndex:endIndex) < 0.0_pReal)) extmsg = trim(extmsg)//' atol_gamma' ! global alias - plasticState(p)%slipRate => plasticState(p)%dotState(startIndex:endIndex,:) + plasticState(ph)%slipRate => plasticState(ph)%dotState(startIndex:endIndex,:) startIndex = endIndex + 1 endIndex = endIndex + prm%sum_N_tw - stt%gamma_twin => plasticState(p)%state (startIndex:endIndex,:) - dot%gamma_twin => plasticState(p)%dotState(startIndex:endIndex,:) - 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' + stt%gamma_twin => plasticState(ph)%state (startIndex:endIndex,:) + dot%gamma_twin => plasticState(ph)%dotState(startIndex:endIndex,:) + plasticState(ph)%atol(startIndex:endIndex) = pl%get_asFloat('atol_gamma',defaultVal=1.0e-6_pReal) + if(any(plasticState(ph)%atol(startIndex:endIndex) < 0.0_pReal)) extmsg = trim(extmsg)//' atol_gamma' - plasticState(p)%state0 = plasticState(p)%state ! ToDo: this could be done centrally + plasticState(ph)%state0 = plasticState(ph)%state ! ToDo: this could be done centrally end associate From b6146a8cc61ba710f597f70ab2fbd681dc18e27f Mon Sep 17 00:00:00 2001 From: Test User Date: Tue, 16 Feb 2021 19:17:18 +0100 Subject: [PATCH 59/60] [skip ci] updated version information after successful test of v3.0.0-alpha2-469-gcf3084a5c --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 0a4efbf53..341603c75 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v3.0.0-alpha2-442-ge2708d29f +v3.0.0-alpha2-469-gcf3084a5c From 36db53f260701bcffe9212511961f10486705edd Mon Sep 17 00:00:00 2001 From: Test User Date: Fri, 19 Feb 2021 16:05:33 +0100 Subject: [PATCH 60/60] [skip ci] updated version information after successful test of v3.0.0-alpha2-478-gc9e4dc21f --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 341603c75..26e9be190 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v3.0.0-alpha2-469-gcf3084a5c +v3.0.0-alpha2-478-gc9e4dc21f