Download 03.py from TestCaseGeneration/NumFEM_Eval: direct link, hf CLI and curl.
- Browser
- Download file 917 Bytes
-
https://huggingface.co/datasets/TestCaseGeneration/NumFEM_Eval/resolve/main/03.py
- Command line
-
hf download hf://datasets/TestCaseGeneration/NumFEM_Eval/03.py
-
curl -L -o 03.py https://huggingface.co/datasets/TestCaseGeneration/NumFEM_Eval/resolve/main/03.py
917 Bytes
| def iso_quad(element_nodes, xi, eta): | |
| from numpy import sum,array | |
| from numpy.linalg import det | |
| from numpy.linalg import inv | |
| shape = array([(1.0 - xi) * (1.0 - eta) / 4.0,(1.0 + xi) * (1.0 - eta) / 4.0,(1.0 + xi) * (1.0 + eta) / 4.0,(1.0 - xi) * (1.0 + eta) / 4.0]) | |
| shape_dxi = array([-(1.0 - eta) / 4.0,(1.0 - eta) / 4.0,(1.0 + eta) / 4.0,-(1.0 + eta) / 4.0]) | |
| shape_deta = array([-(1.0 - xi) / 4.0,-(1.0 + xi) / 4.0,(1.0 + xi) / 4.0,(1.0 - xi) / 4.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 |