Merge remote-tracking branch 'origin/development' into Marc-use-statev-2

PRIVATE repository is synced again (including changes to RGC test)
This commit is contained in:
Martin Diehl 2020-09-08 23:24:57 +02:00
commit b1b556fc08
8 changed files with 29 additions and 40 deletions

View File

@ -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

@ -1 +1 @@
Subproject commit 0cbe1cdb13388e33ecc0427d83aab0e090ca8f9d
Subproject commit 1b82ac39703fdea70962aea47a0381d50bd1d44e

View File

@ -1 +1 @@
v3.0.0-alpha-89-g23d61511
v3.0.0-alpha-92-g751bf786

View File

@ -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)

View File

@ -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)):

View File

@ -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)

View File

@ -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')

View File

@ -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
W_crit !< critical elastic strain energy
character(len=pStringLen), allocatable, dimension(:) :: &
output
end type tParameters
@ -64,8 +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%N = src%get_asFloat('m')
prm%critStrainEnergy = src%get_asFloat('W_crit')
prm%W_crit = src%get_asFloat('W_crit')
#if defined (__GFORTRAN__)
prm%output = output_asStrings(src)
@ -74,8 +72,7 @@ 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'
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)
@ -125,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) = &
@ -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