Merge branch 'load2Dtensor' into 'development'
support for 2D tensor in load case See merge request damask/DAMASK!391
This commit is contained in:
commit
d1a6607782
|
@ -6,9 +6,7 @@ solver:
|
|||
loadstep:
|
||||
- boundary_conditions:
|
||||
mechanical:
|
||||
dot_F: [0, 0, 0,
|
||||
1e-3, 0, 0,
|
||||
0, 0, 0]
|
||||
dot_F: [ [0, 0, 0], [1e-3, 0, 0], [0, 0, 0] ]
|
||||
discretization:
|
||||
t: 60
|
||||
N: 120
|
||||
|
|
|
@ -6,9 +6,7 @@ solver:
|
|||
loadstep:
|
||||
- boundary_conditions:
|
||||
mechanical:
|
||||
dot_F: [0, 0, 1e-3,
|
||||
0, 0, 0,
|
||||
0, 0, 0]
|
||||
dot_F: [[0, 0, 1e-3], [0, 0, 0], [0, 0, 0]]
|
||||
discretization:
|
||||
t: 60
|
||||
N: 120
|
||||
|
|
|
@ -6,24 +6,24 @@ solver:
|
|||
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]
|
||||
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
|
||||
- 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]
|
||||
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
|
||||
|
|
|
@ -7,7 +7,6 @@ import numpy as np
|
|||
import yaml
|
||||
|
||||
from . import Rotation
|
||||
from . import Orientation
|
||||
|
||||
class NiceDumper(yaml.SafeDumper):
|
||||
"""Make YAML readable for humans."""
|
||||
|
@ -25,8 +24,10 @@ class NiceDumper(yaml.SafeDumper):
|
|||
"""Cast Config objects and its subclasses to dict."""
|
||||
if isinstance(data, dict) and type(data) != dict:
|
||||
return self.represent_data(dict(data))
|
||||
if isinstance(data, (Rotation, Orientation)):
|
||||
return self.represent_data(data.as_quaternion())
|
||||
if isinstance(data, np.ndarray):
|
||||
return self.represent_data(data.tolist())
|
||||
if isinstance(data, Rotation):
|
||||
return self.represent_data(data.quaternion.tolist())
|
||||
else:
|
||||
return super().represent_data(data)
|
||||
|
||||
|
|
|
@ -107,9 +107,7 @@ program DAMASK_grid
|
|||
thermal, &
|
||||
step_bc, &
|
||||
step_mech, &
|
||||
step_discretization, &
|
||||
step_deformation, &
|
||||
step_stress
|
||||
step_discretization
|
||||
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
! init DAMASK (all modules)
|
||||
|
@ -198,26 +196,10 @@ program DAMASK_grid
|
|||
select case (step_mech%getKey(m))
|
||||
case ('L','dot_F','F') ! assign values for the deformation BC matrix
|
||||
loadCases(l)%deformation%myType = step_mech%getKey(m)
|
||||
step_deformation => step_mech%get(m)
|
||||
|
||||
temp_valueVector = 0.0_pReal
|
||||
do j = 1, 9
|
||||
temp_maskVector(j) = step_deformation%get_asString(j) /= 'x'
|
||||
if (temp_maskVector(j)) temp_valueVector(j) = step_deformation%get_asFloat(j)
|
||||
enddo
|
||||
loadCases(l)%deformation%mask = transpose(reshape(temp_maskVector,[3,3]))
|
||||
loadCases(l)%deformation%values = math_9to33(temp_valueVector)
|
||||
call getMaskedTensor(loadCases(l)%deformation%values,loadCases(l)%deformation%mask,step_mech%get(m))
|
||||
case ('dot_P','P')
|
||||
loadCases(l)%stress%myType = step_mech%getKey(m)
|
||||
step_stress => step_mech%get(m)
|
||||
|
||||
temp_valueVector = 0.0_pReal
|
||||
do j = 1, 9
|
||||
temp_maskVector(j) = step_stress%get_asString(j) /= 'x'
|
||||
if (temp_maskVector(j)) temp_valueVector(j) = step_stress%get_asFloat(j)
|
||||
enddo
|
||||
loadCases(l)%stress%mask = transpose(reshape(temp_maskVector,[3,3]))
|
||||
loadCases(l)%stress%values = math_9to33(temp_valueVector)
|
||||
call getMaskedTensor(loadCases(l)%stress%values,loadCases(l)%stress%mask,step_mech%get(m))
|
||||
end select
|
||||
call loadCases(l)%rot%fromAxisAngle(step_mech%get_as1dFloat('R',defaultVal = real([0.0,0.0,1.0,0.0],pReal)),degrees=.true.)
|
||||
enddo readMech
|
||||
|
@ -487,4 +469,35 @@ program DAMASK_grid
|
|||
|
||||
call quit(0) ! no complains ;)
|
||||
|
||||
|
||||
contains
|
||||
|
||||
subroutine getMaskedTensor(values,mask,tensor)
|
||||
|
||||
real(pReal), intent(out), dimension(3,3) :: values
|
||||
logical, intent(out), dimension(3,3) :: mask
|
||||
class (tNode), pointer :: tensor
|
||||
|
||||
class (tNode), pointer :: row
|
||||
integer :: i,j
|
||||
|
||||
|
||||
values = 0.0
|
||||
if (tensor%length == 9) then ! temporary support for deprecated 1D tensor
|
||||
do i = 1,9
|
||||
mask((i-1)/3+1,mod(i-1,3)+1) = tensor%get_asString(i) /= 'x'
|
||||
if (mask((i-1)/3+1,mod(i-1,3)+1)) values((i-1)/3+1,mod(i-1,3)+1) = tensor%get_asFloat(i)
|
||||
enddo
|
||||
else
|
||||
do i = 1,3
|
||||
row => tensor%get(i)
|
||||
do j = 1,3
|
||||
mask(i,j) = row%get_asString(j) /= 'x' ! ToDo change to np.masked behavior
|
||||
if (mask(i,j)) values(i,j) = row%get_asFloat(j)
|
||||
enddo
|
||||
enddo
|
||||
endif
|
||||
|
||||
end subroutine
|
||||
|
||||
end program DAMASK_grid
|
||||
|
|
Loading…
Reference in New Issue