import damask
def inversion(l,fill=0):
return [inversion(i,fill) if isinstance(i,list) else\
fill if i == 'x' else 'x' for i in l]
load_case = damask.LoadcaseGrid(solver={'mechanical':'spectral_basic'})
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)
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)
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)
load_case.save('tension-hold-unload.yaml')
load_case
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}