Created
December 5, 2014 14:41
-
-
Save rleegates/d5f13ab5524878c99b19 to your computer and use it in GitHub Desktop.
Computes element coordinate from global coordinate
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% local coordinates from global coordinates | |
function eta = globalToLocal(obj, xPt, nodalX) | |
% tolerance | |
tol = 1e-13; | |
% get an initial guess at [0,0] | |
eta = zeros(size(xPt)); | |
% NR iteration | |
deta = 1; | |
iter = 0; | |
maxIter = 20; | |
while norm(deta) > tol | |
iter = iter+1; | |
if iter > maxIter | |
disp('Convergence not met!'); | |
break; | |
end | |
N = obj.shapeFun(eta); | |
dN_deta = obj.shapeFunDeriv(eta); | |
deta = -(nodalX*dN_deta)\(nodalX*N - xPt); | |
eta = eta + deta; | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment