Generate a Three-Step Load Case for the Grid Solver#

[1]:
import damask
[2]:
def inversion(l,fill=0):
    return [inversion(i,fill) if isinstance(i,list) else\
            fill if i == 'x' else 'x' for i in l]
[3]:
load_case = damask.LoadcaseGrid(solver={'mechanical':'spectral_basic'})
[4]:
F = [[1.05, 0 , 0 ],
     [   0,'x', 0 ],
     [   0, 0 ,'x']]

loadstep = {'boundary_conditions':{'mechanical':{'F':F,
                                                 'P':inversion(F)}},
                                   'discretization':{'t':10.,'N':40},'f_out':4}
load_case['loadstep'].append(loadstep)
[5]:
dot_P = [[ 0 ,'x','x'],
         ['x','x','x'],
         ['x','x','x']]

loadstep = {'boundary_conditions':{'mechanical':{'dot_P':dot_P,
                                                 'dot_F':inversion(dot_P)}},
                                   'discretization':{'t':10.,'N':20}}
load_case['loadstep'].append(loadstep)
[6]:
P = [[ 0 ,'x','x'],
     ['x', 0 ,'x'],
     ['x','x', 0 ]]

loadstep = {'boundary_conditions':{'mechanical':{'P':P,
                                                 'dot_F':inversion(P)}},
                                   'discretization':{'t':10.,'N':20}}
load_case['loadstep'].append(loadstep)
[7]:
load_case.save('tension-hold-unload.yaml')
load_case
[7]:
solver: {mechanical: spectral_basic}
loadstep:
- boundary_conditions:
    mechanical:
      F:
      - [1.05, 0, 0]
      - [0, x, 0]
      - [0, 0, x]
      P:
      - [x, x, x]
      - [x, 0, x]
      - [x, x, 0]
  discretization: {t: 10.0, N: 40}
  f_out: 4
- boundary_conditions:
    mechanical:
      dot_P:
      - [0, x, x]
      - [x, x, x]
      - [x, x, x]
      dot_F:
      - [x, 0, 0]
      - [0, 0, 0]
      - [0, 0, 0]
  discretization: {t: 10.0, N: 20}
- boundary_conditions:
    mechanical:
      P:
      - [0, x, x]
      - [x, 0, x]
      - [x, x, 0]
      dot_F:
      - [x, 0, 0]
      - [0, x, 0]
      - [0, 0, x]
  discretization: {t: 10.0, N: 20}