Download 04.py from TestCaseGeneration/NumFEM_Eval: direct link, hf CLI and curl.
- Browser
- Download file 723 Bytes
-
https://huggingface.co/datasets/TestCaseGeneration/NumFEM_Eval/resolve/main/04.py
- Command line
-
hf download hf://datasets/TestCaseGeneration/NumFEM_Eval/04.py
-
curl -L -o 04.py https://huggingface.co/datasets/TestCaseGeneration/NumFEM_Eval/resolve/main/04.py
723 Bytes
| def iso_triangle(element_nodes, xi, eta): | |
| from numpy import array | |
| from numpy import sum | |
| from numpy.linalg import det | |
| from numpy.linalg import inv | |
| shape = array([1.0 - xi - eta,xi,eta]) | |
| shape_dxi = array([-1.0,1.0,0.0]) | |
| shape_deta = array([-1.0,0.0,1.0]) | |
| x = element_nodes[:, 0] | |
| y = element_nodes[:, 1] | |
| jacobi = array([[sum(shape_dxi * x), sum(shape_dxi * y)],[sum(shape_deta * x), sum(shape_deta * y)]]) | |
| jacobian = det(jacobi) | |
| inverted_jacobi = inv(jacobi) | |
| shape_dx = inverted_jacobi[0, 0] * shape_dxi + inverted_jacobi[0, 1] * shape_deta | |
| shape_dy = inverted_jacobi[1, 0] * shape_dxi + inverted_jacobi[1, 1] * shape_deta | |
| return jacobian, shape, shape_dx, shape_dy |