Rescale a Grid Solver Geometry File

[1]:
import damask
[2]:
# adjust to your situation, input file needs to exist
file_name_in  = 'rescale_grid/20grains64x64x64.vti'
cells = [40,40,40]
file_name_out = '20grains40x40x40.vti'

[3]:
grid = damask.Grid.load(file_name_in)
grid
[3]:
cells  a b c: 64 x 64 x 64
size   x y z: 1.0 x 1.0 x 1.0
origin x y z: 0.0   0.0   0.0
# materials: 20
[4]:
grid = grid.scale(cells)
grid.save(file_name_out)
grid
[4]:
cells  a b c: 40 x 40 x 40
size   x y z: 1.0 x 1.0 x 1.0
origin x y z: 0.0   0.0   0.0
# materials: 20