PDA

View Full Version : Coordinate Transformation


Clausius2
Oct16-04, 01:17 PM
Ok, I have a strong problem. It has to do with programming and concepts of mathematics.

I have a coordinate transformation:

x=x(\xi,\eta)
y=y(\xi,\eta);

and I want to calculate the metrics coefficients:

\xi_x=\frac{\partial \xi}{\partial x}
\eta_x=\frac{\partial \eta}{\partial x}
\xi_y=\frac{\partial \xi}{\partial y}
\eta_y=\frac{\partial \eta}{\partial y}

But I have only the next (I only have the numeric transformation, I don't have any analytical formulae):

x= a matrix of dimensions n_{\xi}, n_{\eta};
y= a matrix of dimensions n_{\xi}, n_{\eta};

\xi= a vector of size n_{\xi}
\eta= a vector of size n_{\eta}

Well, I want to compute the metrics coefficients using central diferences. Please, tell me what would you do in order to compute it. I'm goind to show you what i made in Matlab:

for i=2:nxi-1;
for j=2:neta-1;

XI_x(i)=(XI(i+1)-XI(i-1))/(x(i+1,j)-x(i-1,j));
ETA_x(j)=(ETA(j+1)-ETA(j-1))/(x(i,j+1)-x(i,j-1));
XI_y(i)=(XI(i+1)-XI(i-1))/(y(i+1,j)-y(i-1,j));
ETA_y(j)=(ETA(j+1)-ETA(j-1))/(y(i,j+1)-y(i,j-1));

end
end

I'm not sure it works, because I'm not able to imagine the metrics coefficients just acting upon the functions x and y. I don't know If i'm taking correctly the variations in x and y in the denominators.

Any advice will be greatly appreciated.