add stress tensor function