From 2f7414de229aaffb3135078a0eb4152f3f0e2862 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Mon, 7 Sep 2020 11:46:12 +0200 Subject: [PATCH 01/10] only m=1 makes sense for isobrittle --- src/source_damage_isoBrittle.f90 | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/source_damage_isoBrittle.f90 b/src/source_damage_isoBrittle.f90 index b1abcf14d..7d21ba8af 100644 --- a/src/source_damage_isoBrittle.f90 +++ b/src/source_damage_isoBrittle.f90 @@ -12,8 +12,7 @@ submodule(constitutive:constitutive_damage) source_damage_isoBrittle type :: tParameters !< container type for internal constitutive parameters real(pReal) :: & - critStrainEnergy, & !< critical elastic strain energy - N + critStrainEnergy !< critical elastic strain energy character(len=pStringLen), allocatable, dimension(:) :: & output end type tParameters @@ -64,7 +63,6 @@ module function source_damage_isoBrittle_init(source_length) result(mySources) associate(prm => param(source_damage_isoBrittle_instance(p))) src => sources%get(sourceOffset) - prm%N = src%get_asFloat('m') prm%critStrainEnergy = src%get_asFloat('W_crit') #if defined (__GFORTRAN__) @@ -74,7 +72,6 @@ module function source_damage_isoBrittle_init(source_length) result(mySources) #endif ! sanity checks - if (prm%N <= 0.0_pReal) extmsg = trim(extmsg)//' m' if (prm%critStrainEnergy <= 0.0_pReal) extmsg = trim(extmsg)//' W_crit' NipcMyPhase = count(material_phaseAt==p) * discretization_nIP @@ -161,10 +158,9 @@ module subroutine source_damage_isoBrittle_getRateAndItsTangent(localphiDot, dLo sourceOffset = source_damage_isoBrittle_offset(phase) associate(prm => param(source_damage_isoBrittle_instance(phase))) - localphiDot = (1.0_pReal - phi)**(prm%n - 1.0_pReal) & + localphiDot = 1.0_pReal & - phi*sourceState(phase)%p(sourceOffset)%state(1,constituent) - dLocalphiDot_dPhi = - (prm%n - 1.0_pReal)* (1.0_pReal - phi)**max(0.0_pReal,prm%n - 2.0_pReal) & - - sourceState(phase)%p(sourceOffset)%state(1,constituent) + dLocalphiDot_dPhi = - sourceState(phase)%p(sourceOffset)%state(1,constituent) end associate end subroutine source_damage_isoBrittle_getRateAndItsTangent From 751bf7862d19e13e6ea1e3f0d5dd5bd59555637e Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Mon, 7 Sep 2020 11:48:26 +0200 Subject: [PATCH 02/10] variable name = parameter name --- src/source_damage_isoBrittle.f90 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/source_damage_isoBrittle.f90 b/src/source_damage_isoBrittle.f90 index 7d21ba8af..4156e9213 100644 --- a/src/source_damage_isoBrittle.f90 +++ b/src/source_damage_isoBrittle.f90 @@ -12,7 +12,7 @@ submodule(constitutive:constitutive_damage) source_damage_isoBrittle type :: tParameters !< container type for internal constitutive parameters real(pReal) :: & - critStrainEnergy !< critical elastic strain energy + W_crit !< critical elastic strain energy character(len=pStringLen), allocatable, dimension(:) :: & output end type tParameters @@ -63,7 +63,7 @@ module function source_damage_isoBrittle_init(source_length) result(mySources) associate(prm => param(source_damage_isoBrittle_instance(p))) src => sources%get(sourceOffset) - prm%critStrainEnergy = src%get_asFloat('W_crit') + prm%W_crit = src%get_asFloat('W_crit') #if defined (__GFORTRAN__) prm%output = output_asStrings(src) @@ -72,7 +72,7 @@ module function source_damage_isoBrittle_init(source_length) result(mySources) #endif ! sanity checks - if (prm%critStrainEnergy <= 0.0_pReal) extmsg = trim(extmsg)//' W_crit' + if (prm%W_crit <= 0.0_pReal) extmsg = trim(extmsg)//' W_crit' NipcMyPhase = count(material_phaseAt==p) * discretization_nIP call constitutive_allocateState(sourceState(p)%p(sourceOffset),NipcMyPhase,1,1,1) @@ -122,8 +122,8 @@ module subroutine source_damage_isoBrittle_deltaState(C, Fe, ipc, ip, el) strain = 0.5_pReal*math_sym33to6(matmul(transpose(Fe),Fe)-math_I3) associate(prm => param(source_damage_isoBrittle_instance(phase))) - strainenergy = 2.0_pReal*sum(strain*matmul(C,strain))/prm%critStrainEnergy - ! ToDo: check strainenergy = 2.0_pReal*dot_product(strain,matmul(C,strain))/param(instance)%critStrainEnergy + 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 > sourceState(phase)%p(sourceOffset)%subState0(1,constituent)) then sourceState(phase)%p(sourceOffset)%deltaState(1,constituent) = & From 715a55b4c81f3704607a42040c00e294d8e6cb6c Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Mon, 7 Sep 2020 13:19:38 +0200 Subject: [PATCH 03/10] geom file format will be removed soon. No need to test --- .gitlab-ci.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a88b330bd..4c33f83e7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -251,13 +251,6 @@ Thermal: - master - release -grid_packedGeometry: - stage: grid - script: grid_packedGeometry/test.py - except: - - master - - release - grid_parsingArguments: stage: grid script: grid_parsingArguments/test.py From d176a89c78e5cfc7c802d22be9d4337d4f369627 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Mon, 7 Sep 2020 13:20:00 +0200 Subject: [PATCH 04/10] ensure defined initital state --- src/homogenization_mech_RGC.f90 | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/homogenization_mech_RGC.f90 b/src/homogenization_mech_RGC.f90 index 1d1348d69..d3990e266 100644 --- a/src/homogenization_mech_RGC.f90 +++ b/src/homogenization_mech_RGC.f90 @@ -85,7 +85,7 @@ module subroutine mech_RGC_init(num_homogMech) h, & NofMyHomog, & sizeState, nIntFaceTot - + class (tNode), pointer :: & num_RGC, & ! pointer to RGC numerics data material_homogenization, & @@ -107,7 +107,7 @@ module subroutine mech_RGC_init(num_homogMech) allocate(state(Ninstance)) allocate(state0(Ninstance)) allocate(dependentState(Ninstance)) - + num_RGC => num_homogMech%get('RGC',defaultVal=emptyDict) num%atol = num_RGC%get_asFloat('atol', defaultVal=1.0e+4_pReal) @@ -139,7 +139,7 @@ module subroutine mech_RGC_init(num_homogMech) if (num%volDiscrPow <= 0.0_pReal) call IO_error(301,ext_msg='volDiscrPw_RGC') - material_homogenization => material_root%get('homogenization') + material_homogenization => material_root%get('homogenization') do h = 1, size(homogenization_type) if (homogenization_type(h) /= HOMOGENIZATION_RGC_ID) cycle homog => material_homogenization%get(h) @@ -188,10 +188,10 @@ module subroutine mech_RGC_init(num_homogMech) stt%work => homogState(h)%state(nIntFaceTot+1,:) stt%penaltyEnergy => homogState(h)%state(nIntFaceTot+2,:) - allocate(dst%volumeDiscrepancy( NofMyHomog)) - allocate(dst%relaxationRate_avg( NofMyHomog)) - allocate(dst%relaxationRate_max( NofMyHomog)) - allocate(dst%mismatch( 3,NofMyHomog)) + allocate(dst%volumeDiscrepancy( NofMyHomog), source=0.0_pReal) + allocate(dst%relaxationRate_avg( NofMyHomog), source=0.0_pReal) + allocate(dst%relaxationRate_max( NofMyHomog), source=0.0_pReal) + allocate(dst%mismatch( 3,NofMyHomog), source=0.0_pReal) !-------------------------------------------------------------------------------------------------- ! assigning cluster orientations @@ -959,7 +959,7 @@ module subroutine mech_RGC_results(instance,group) case('W') call results_writeDataset(group,stt%work,trim(prm%output(o)), & 'work density','J/m³') - case('M') + case('M') call results_writeDataset(group,dst%mismatch,trim(prm%output(o)), & 'average mismatch tensor','1') case('R') From 774cf7658ef485608d3df166e8fd817fc1814dff Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Mon, 7 Sep 2020 13:23:42 +0200 Subject: [PATCH 05/10] pytest now includes RGC test --- PRIVATE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PRIVATE b/PRIVATE index c6dc3f116..49677b603 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit c6dc3f116fc6007caf076772d5c29f0a0523544d +Subproject commit 49677b603263c3838e1702e2dd521c680b0162ad From d78bc8102695a0196b7297ad5bf413d6438cfa9f Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Mon, 7 Sep 2020 18:27:06 +0200 Subject: [PATCH 06/10] use test which is insensitive to numerical noise --- PRIVATE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PRIVATE b/PRIVATE index 49677b603..e92df7d5a 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit 49677b603263c3838e1702e2dd521c680b0162ad +Subproject commit e92df7d5a475d1e3d382517f49b6569cdcbd9b80 From e270b5fe5fdaa8d0390146c34e644b98a930b3c9 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Mon, 7 Sep 2020 18:29:08 +0200 Subject: [PATCH 07/10] cleaned tests --- PRIVATE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PRIVATE b/PRIVATE index e92df7d5a..a13f94880 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit e92df7d5a475d1e3d382517f49b6569cdcbd9b80 +Subproject commit a13f94880aeae06c14bde50c15f00d7f076d23ad From a6503fe5955fc6a799d34af7e25196cdd2c7c950 Mon Sep 17 00:00:00 2001 From: Test User Date: Tue, 8 Sep 2020 13:04:39 +0200 Subject: [PATCH 08/10] [skip ci] updated version information after successful test of v3.0.0-alpha-92-g751bf786 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 47c9c3f59..a76c23653 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v3.0.0-alpha-89-g23d61511 +v3.0.0-alpha-92-g751bf786 From c6b1a6feed39ab500a85f492ea10e4cb7c9df420 Mon Sep 17 00:00:00 2001 From: Test User Date: Tue, 8 Sep 2020 15:36:39 +0200 Subject: [PATCH 09/10] [skip ci] updated version information after successful test of v3.0.0-alpha-98-gf38e3257 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 47c9c3f59..24663499f 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v3.0.0-alpha-89-g23d61511 +v3.0.0-alpha-98-gf38e3257 From 9fb3fef4b08d54abd0ebc289374f4d1c512e292c Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Tue, 8 Sep 2020 10:39:31 -0400 Subject: [PATCH 10/10] changed British "normalise" to US "normalize" as we (should) follow US English everywhere else. --- processing/post/addOrientations.py | 4 ++-- python/damask/_rotation.py | 8 ++++---- python/tests/test_Rotation.py | 12 ++++++------ 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/processing/post/addOrientations.py b/processing/post/addOrientations.py index 79da15fdd..51d668eb9 100755 --- a/processing/post/addOrientations.py +++ b/processing/post/addOrientations.py @@ -104,8 +104,8 @@ input = [options.eulers is not None, if np.sum(input) != 1: parser.error('needs exactly one input format.') -r = damask.Rotation.from_axis_angle(np.array(options.crystalrotation),options.degrees,normalise=True) -R = damask.Rotation.from_axis_angle(np.array(options.labrotation),options.degrees,normalise=True) +r = damask.Rotation.from_axis_angle(np.array(options.crystalrotation),options.degrees,normalize=True) +R = damask.Rotation.from_axis_angle(np.array(options.labrotation),options.degrees,normalize=True) for name in filenames: damask.util.report(scriptName,name) diff --git a/python/damask/_rotation.py b/python/damask/_rotation.py index 9ee7fd5cc..ac7b3ace8 100644 --- a/python/damask/_rotation.py +++ b/python/damask/_rotation.py @@ -408,7 +408,7 @@ class Rotation: @staticmethod def from_axis_angle(axis_angle, degrees = False, - normalise = False, + normalize = False, P = -1): """ Initialize from Axis angle pair. @@ -434,7 +434,7 @@ class Rotation: if P == 1: ax[...,0:3] *= -1 if degrees: ax[..., 3] = np.radians(ax[...,3]) - if normalise: ax[...,0:3] /= np.linalg.norm(ax[...,0:3],axis=-1) + if normalize: ax[...,0:3] /= np.linalg.norm(ax[...,0:3],axis=-1) if np.any(ax[...,3] < 0.0) or np.any(ax[...,3] > np.pi): raise ValueError('Axis angle rotation angle outside of [0..π].') if not np.all(np.isclose(np.linalg.norm(ax[...,0:3],axis=-1), 1.0)): @@ -493,7 +493,7 @@ class Rotation: @staticmethod def from_Rodrigues(rho, - normalise = False, + normalize = False, P = -1): """ Initialize from Rodrigues-Frank vector. @@ -516,7 +516,7 @@ class Rotation: raise ValueError('P ∉ {-1,1}') if P == 1: ro[...,0:3] *= -1 - if normalise: ro[...,0:3] /= np.linalg.norm(ro[...,0:3],axis=-1) + if normalize: ro[...,0:3] /= np.linalg.norm(ro[...,0:3],axis=-1) if np.any(ro[...,3] < 0.0): raise ValueError('Rodrigues vector rotation angle not positive.') if not np.all(np.isclose(np.linalg.norm(ro[...,0:3],axis=-1), 1.0)): diff --git a/python/tests/test_Rotation.py b/python/tests/test_Rotation.py index 8b26a7472..3ed1f27c6 100644 --- a/python/tests/test_Rotation.py +++ b/python/tests/test_Rotation.py @@ -698,13 +698,13 @@ class TestRotation: assert ok and np.isclose(np.linalg.norm(o),1.0) @pytest.mark.parametrize('P',[1,-1]) - @pytest.mark.parametrize('normalise',[True,False]) + @pytest.mark.parametrize('normalize',[True,False]) @pytest.mark.parametrize('degrees',[True,False]) - def test_axis_angle(self,set_of_rotations,degrees,normalise,P): + def test_axis_angle(self,set_of_rotations,degrees,normalize,P): c = np.array([P*-1,P*-1,P*-1,1.]) for rot in set_of_rotations: m = rot.as_Eulers() - o = Rotation.from_axis_angle(rot.as_axis_angle(degrees)*c,degrees,normalise,P).as_Eulers() + o = Rotation.from_axis_angle(rot.as_axis_angle(degrees)*c,degrees,normalize,P).as_Eulers() u = np.array([np.pi*2,np.pi,np.pi*2]) ok = np.allclose(m,o,atol=atol) ok = ok or np.allclose(np.where(np.isclose(m,u),m-u,m),np.where(np.isclose(o,u),o-u,o),atol=atol) @@ -725,12 +725,12 @@ class TestRotation: assert ok and np.isclose(np.linalg.norm(o[:3]),1.0) and o[3]<=np.pi+1.e-9 @pytest.mark.parametrize('P',[1,-1]) - @pytest.mark.parametrize('normalise',[True,False]) - def test_Rodrigues(self,set_of_rotations,normalise,P): + @pytest.mark.parametrize('normalize',[True,False]) + def test_Rodrigues(self,set_of_rotations,normalize,P): c = np.array([P*-1,P*-1,P*-1,1.]) for rot in set_of_rotations: m = rot.as_matrix() - o = Rotation.from_Rodrigues(rot.as_Rodrigues()*c,normalise,P).as_matrix() + o = Rotation.from_Rodrigues(rot.as_Rodrigues()*c,normalize,P).as_matrix() ok = np.allclose(m,o,atol=atol) print(m,o) assert ok and np.isclose(np.linalg.det(o),1.0)