support for 2D tensor in load case
currently optional, but should become mandatory after a transition period
This commit is contained in:
parent
711a42565c
commit
adb1e51e24
|
@ -6,9 +6,7 @@ solver:
|
||||||
loadstep:
|
loadstep:
|
||||||
- boundary_conditions:
|
- boundary_conditions:
|
||||||
mechanical:
|
mechanical:
|
||||||
dot_F: [0, 0, 0,
|
dot_F: [ [0, 0, 0], [1e-3, 0, 0], [0, 0, 0] ]
|
||||||
1e-3, 0, 0,
|
|
||||||
0, 0, 0]
|
|
||||||
discretization:
|
discretization:
|
||||||
t: 60
|
t: 60
|
||||||
N: 120
|
N: 120
|
||||||
|
|
|
@ -6,9 +6,7 @@ solver:
|
||||||
loadstep:
|
loadstep:
|
||||||
- boundary_conditions:
|
- boundary_conditions:
|
||||||
mechanical:
|
mechanical:
|
||||||
dot_F: [0, 0, 1e-3,
|
dot_F: [[0, 0, 1e-3], [0, 0, 0], [0, 0, 0]]
|
||||||
0, 0, 0,
|
|
||||||
0, 0, 0]
|
|
||||||
discretization:
|
discretization:
|
||||||
t: 60
|
t: 60
|
||||||
N: 120
|
N: 120
|
||||||
|
|
|
@ -6,24 +6,24 @@ solver:
|
||||||
loadstep:
|
loadstep:
|
||||||
- boundary_conditions:
|
- boundary_conditions:
|
||||||
mechanical:
|
mechanical:
|
||||||
dot_F: [1.0e-3, 0, 0,
|
dot_F: [[1.0e-3, 0, 0],
|
||||||
0, x, 0,
|
[0, x, 0],
|
||||||
0, 0, x]
|
[0, 0, x]]
|
||||||
P: [x, x, x,
|
P: [[x, x, x],
|
||||||
x, 0, x,
|
[x, 0, x],
|
||||||
x, x, 0]
|
[x, x, 0]]
|
||||||
discretization:
|
discretization:
|
||||||
t: 10
|
t: 10
|
||||||
N: 40
|
N: 40
|
||||||
f_out: 4
|
f_out: 4
|
||||||
- boundary_conditions:
|
- boundary_conditions:
|
||||||
mechanical:
|
mechanical:
|
||||||
dot_F: [1.0e-3, 0, 0,
|
dot_F: [[1.0e-3, 0, 0],
|
||||||
0, x, 0,
|
[0, x, 0],
|
||||||
0, 0, x]
|
[0, 0, x]]
|
||||||
P: [x, x, x,
|
P: [[x, x, x],
|
||||||
x, 0, x,
|
[x, 0, x],
|
||||||
x, x, 0]
|
[x, x, 0]]
|
||||||
discretization:
|
discretization:
|
||||||
t: 60
|
t: 60
|
||||||
N: 60
|
N: 60
|
||||||
|
|
|
@ -7,7 +7,6 @@ import numpy as np
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
from . import Rotation
|
from . import Rotation
|
||||||
from . import Orientation
|
|
||||||
|
|
||||||
class NiceDumper(yaml.SafeDumper):
|
class NiceDumper(yaml.SafeDumper):
|
||||||
"""Make YAML readable for humans."""
|
"""Make YAML readable for humans."""
|
||||||
|
@ -25,8 +24,10 @@ class NiceDumper(yaml.SafeDumper):
|
||||||
"""Cast Config objects and its subclasses to dict."""
|
"""Cast Config objects and its subclasses to dict."""
|
||||||
if isinstance(data, dict) and type(data) != dict:
|
if isinstance(data, dict) and type(data) != dict:
|
||||||
return self.represent_data(dict(data))
|
return self.represent_data(dict(data))
|
||||||
if isinstance(data, (Rotation, Orientation)):
|
if isinstance(data, np.ndarray):
|
||||||
return self.represent_data(data.as_quaternion())
|
return self.represent_data(data.tolist())
|
||||||
|
if isinstance(data, Rotation):
|
||||||
|
return self.represent_data(data.quaternion.tolist())
|
||||||
else:
|
else:
|
||||||
return super().represent_data(data)
|
return super().represent_data(data)
|
||||||
|
|
||||||
|
|
|
@ -107,9 +107,7 @@ program DAMASK_grid
|
||||||
thermal, &
|
thermal, &
|
||||||
step_bc, &
|
step_bc, &
|
||||||
step_mech, &
|
step_mech, &
|
||||||
step_discretization, &
|
step_discretization
|
||||||
step_deformation, &
|
|
||||||
step_stress
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
! init DAMASK (all modules)
|
! init DAMASK (all modules)
|
||||||
|
@ -198,26 +196,10 @@ program DAMASK_grid
|
||||||
select case (step_mech%getKey(m))
|
select case (step_mech%getKey(m))
|
||||||
case ('L','dot_F','F') ! assign values for the deformation BC matrix
|
case ('L','dot_F','F') ! assign values for the deformation BC matrix
|
||||||
loadCases(l)%deformation%myType = step_mech%getKey(m)
|
loadCases(l)%deformation%myType = step_mech%getKey(m)
|
||||||
step_deformation => step_mech%get(m)
|
call getMaskedTensor(loadCases(l)%deformation%values,loadCases(l)%deformation%mask,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)
|
|
||||||
case ('dot_P','P')
|
case ('dot_P','P')
|
||||||
loadCases(l)%stress%myType = step_mech%getKey(m)
|
loadCases(l)%stress%myType = step_mech%getKey(m)
|
||||||
step_stress => step_mech%get(m)
|
call getMaskedTensor(loadCases(l)%stress%values,loadCases(l)%stress%mask,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)
|
|
||||||
end select
|
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.)
|
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
|
enddo readMech
|
||||||
|
@ -487,4 +469,35 @@ program DAMASK_grid
|
||||||
|
|
||||||
call quit(0) ! no complains ;)
|
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
|
end program DAMASK_grid
|
||||||
|
|
Loading…
Reference in New Issue