Skip to content

Commit d8dc16a

Browse files
committed
interpolate nodal coordinates
1 parent 6043ee5 commit d8dc16a

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

python/damask/_result.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import h5py
1414
import numpy as np
1515
from numpy import ma
16+
from scipy import interpolate
1617

1718
import damask
1819
from . import VTK
@@ -2162,8 +2163,13 @@ def cp(path_in,path_out,label,mapping):
21622163
else:
21632164
u_p = f_in[inc]['geometry']['u_p'][()][mapping_flat]
21642165
f_out[inc]['geometry'].create_dataset('u_p',data=u_p)
2165-
u_n = np.zeros(np.array(cells+(2,))+1).reshape(-1,3)
2166-
f_out[inc]['geometry'].create_dataset('u_n',data=u_n)
2166+
delta = self.size/np.array(mapping.shape)
2167+
c_0_p = tuple([np.linspace(delta[i]/2,self.size[i]-delta[i]/2,mapping.shape[i]) for i in [0,1,2]])
2168+
interpolator = interpolate.RegularGridInterpolator(c_0_p,np.reshape(u_p,tuple(cells)+(3,)),
2169+
fill_value=None,bounds_error=False,method='linear')
2170+
c_0_n = grid_filters.coordinates0_node(mapping.shape,self.size).reshape(-1,3)
2171+
f_out[inc]['geometry'].create_dataset('u_n',data=interpolator(c_0_n))
2172+
f_out[inc]['geometry/u_n'].attrs.update(f_in[inc]['geometry/u_n'].attrs)
21672173

21682174

21692175
for label in self._homogenizations:

0 commit comments

Comments
 (0)