Changeset 27147
- Timestamp:
- 07/06/22 03:25:09 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/m/mesh/ComputeHessian.py
r24213 r27147 39 39 40 40 #compute weights that hold the volume of all the element holding the node i 41 weights = m.sparse(line, np.ones((linesize, 1), dtype=int), np.tile(areas, ( 3, 1)), numberofnodes, 1)41 weights = m.sparse(line, np.ones((linesize, 1), dtype=int), np.tile(areas, (1, 3)), numberofnodes, 1) 42 42 43 43 #compute field on nodes if on elements 44 44 if np.size(field, axis=0) == numberofelements: 45 field = m.sparse(line, np.ones((linesize, 1), dtype=int), np.tile(areas * field, ( 3, 1)), numberofnodes, 1) / weights45 field = m.sparse(line, np.ones((linesize, 1), dtype=int), np.tile(areas * field, (1, 3)), numberofnodes, 1) / weights 46 46 47 47 #Compute gradient for each element … … 50 50 51 51 #Compute gradient for each node (average of the elements around) 52 gradx = m.sparse(line, np.ones((linesize, 1), dtype=int), np.tile((areas * grad_elx), ( 3, 1)), numberofnodes, 1)53 grady = m.sparse(line, np.ones((linesize, 1), dtype=int), np.tile((areas * grad_ely), ( 3, 1)), numberofnodes, 1)52 gradx = m.sparse(line, np.ones((linesize, 1), dtype=int), np.tile((areas * grad_elx), (1, 3)), numberofnodes, 1) 53 grady = m.sparse(line, np.ones((linesize, 1), dtype=int), np.tile((areas * grad_ely), (1, 3)), numberofnodes, 1) 54 54 gradx = gradx / weights 55 55 grady = grady / weights … … 60 60 if m.strcmpi(type, 'node'): 61 61 #Compute Hessian on the nodes (average of the elements around) 62 hessian = np.hstack((m.sparse(line, np.ones((linesize, 1), dtype=int), np.tile((areas * hessian[:, 0]), ( 3, 1)), numberofnodes, 1) / weights,63 m.sparse(line, np.ones((linesize, 1), dtype=int), np.tile((areas * hessian[:, 1]), ( 3, 1)), numberofnodes, 1) / weights,64 m.sparse(line, np.ones((linesize, 1), dtype=int), np.tile((areas * hessian[:, 2]), ( 3, 1)), numberofnodes, 1) / weights))62 hessian = np.hstack((m.sparse(line, np.ones((linesize, 1), dtype=int), np.tile((areas * hessian[:, 0]), (1, 3)), numberofnodes, 1) / weights, 63 m.sparse(line, np.ones((linesize, 1), dtype=int), np.tile((areas * hessian[:, 1]), (1, 3)), numberofnodes, 1) / weights, 64 m.sparse(line, np.ones((linesize, 1), dtype=int), np.tile((areas * hessian[:, 2]), (1, 3)), numberofnodes, 1) / weights)) 65 65 66 66 return hessian
Note:
See TracChangeset
for help on using the changeset viewer.