Generate a Three-Step Load Case for the Grid Solver

[1]:
import damask
[2]:
load_case = damask.Config(solver={'mechanical':'spectral_basic'},
                          loadstep=[])
[3]:
F = [1e-2,0,0, 0,'x',0,  0,0,'x']
P = ['x' if i != 'x' else 0 for i in F]

load_case['loadstep'].append({'boundary_conditions':{},
                              'discretization':{'t':10.,'N':40},'f_out':4})
load_case['loadstep'][0]['boundary_conditions']['mechanical'] = \
    {'P':[P[0:3],P[3:6],P[6:9]],
     'F':[F[0:3],F[3:6],F[6:9]]}
[3]:
dot_P = [0] + ['x']*8
dot_F = ['x' if i != 'x' else 0 for i in dot_P]

load_case['loadstep'].append({'boundary_conditions':{},
                              'discretization':{'t':10.,'N':20}})
load_case['loadstep'][1]['boundary_conditions']['mechanical'] = \
    {'dot_P':[dot_P[0:3],dot_P[3:6],dot_P[6:9]],
     'dot_F':[dot_F[0:3],dot_F[3:6],dot_F[6:9]]}
[5]:
P     = [0,'x','x',  'x',0,'x',   'x','x',0]
dot_F = ['x' if i != 'x' else 0 for i in P]

load_case['loadstep'].append({'boundary_conditions':{},
                              'discretization':{'t':10.,'N':20}})
load_case['loadstep'][2]['boundary_conditions']['mechanical'] = \
    {'P':[P[0:3],P[3:6],P[6:9]],
     'dot_F':[dot_F[0:3],dot_F[3:6],dot_F[6:9]]}
[6]:
print(load_case)
load_case.save('tension-hold-unload.yaml')
solver: {mechanical: spectral_basic}

loadstep:
  - boundary_conditions:
      mechanical:
        P:
          - [x, x, x]
          - [x, 0, x]
          - [x, x, 0]
        dot_F:
          - [0.01, 0, 0]
          - [0, x, 0]
          - [0, 0, x]
    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}