transformation between Cartesian and spherical coordinates?
Hello, can anybody tell me where to get a general program or formula for the transformation between Cartesian and spherical coordinates? I am writing a code to simulate the fuel sprays in the engines and the coordinate transformation for the spray drops is needed. Thank you in advance.

Re: transformation between Cartesian and spherical coordinates?
Hi there,
There are two stages in the transformation: The transformation of the coordinates themselves and the transformation of the Equations You can find the transformation of coordinates in any books in the Department of Physics (and even Engineering or Mathematics) at your University. Many books on Mechanics, Electrodynamics, ... do have an appendix on transformation of coordinates. It should not be a problem to find. Concerning the transformation of the equations (say Euler or NavierStokes) any serious book on CFD should also have a Chapter on that. You can check also books in the Physics Departement like : Hydrodynamics, Landau & Lifshitz (Pergamon Press) I am sure in the Forum, many people can also give you references on some more basic books in CFD with all what you need. However, mainly, you need to GO TO the library and check all that. Good luck, Patrick 
Re: transformation between Cartesian and spherical coordinates?
(1). The basic concept of the coordinates transformation, say between (x1,x2,x3) and (eta1, eta2, eta3), along with the chainrule, should be available in the Calculus or Advanced Calculus. (2). Using the chainrule, one can express the derivatives in (x1,x2,x3) as functions of derivatives in (eta1, eta2, eta3). (3). With these, one can substitute the derivatives into the original equations and obtain the governing equations in the new coordinates system. (4). In the process, the final equation will have numerous terms in it, depending upon the order of the equation. But these can then be regrouped into coefficients of the derivatives in the new coordinates system. (5). Most thermo/fluid handbooks have equations already written in Cartesian, cylindrical, and spherical coordinates.

Re: transformation between Cartesian and spherical coordinates?
Thank you for the responses and helps. In my code, position and velocity vector of the drops need to transfer from the Cartecian coordinate to the Spherical one, and vice versa, for every time step. The equations in the code are kept in the Cartecian coordinate for the calculation. I know the concept of the coordinate transformation and believe that there should be a reday program or formula available somewhere, but I could not find it although I have gone to the library specially.

Re: transformation between Cartesian and spherical coordinates?
(1). I am not getting the picture yet. (2). First of all, you have a fixed coordinates system, (x,y,z). Then you have a particle (drop) located at a position, (xp,yp,zp,t). And the particle velocity is (up, vp, wp,t). (3).Then you would like to introduce a spherical coordinates system? Assuming that the particle is frozen in time,t, is the origin of the spherical coordinates system attached to a). the particle at (xp, yp, zp) ? or b). the origin of the (x,y,z) system? (4). The difference is only the shift of (xp, yp, zp). (5). By using the (xp,zp) you can find the angle theta=atan(zp/xp) on the xzplane. (6). Then find the distance on the xzplane from the origin to (xp,zp) as distance=sqrt(xp*xp + zp*zp) (7). You can then combine the distance with yp to give you another angle alpha=atan(yp/distance). (7). You also need to compute the final radial position as rposition=sqrt(yp*yp + distance*distance). (8). Now you have the coordinates of the particle in the spherical coordinate syatem as (rposition, theat, alpha). and its Cartesian coordinates are (xp, yp, zp). Is that what you are looking for?

Re: coordinate transformation?
Hi, John, Thank you for your help. That's right for the position case, however, maybe it would be complicated for the vector case. Here is a fixed coordinates system, (x,y,z). A droplet is located at a position (xp, yp, zp, t) with its velocity (up, vp, wp, t) and the gas phase velocity (u, v, w, t). The spherical coordinate system would be introduced to attach to the position of the injector nozzle and the r axis (r of spherical one, others are theat and alpha) coincides with the spray axis. I want to transfer the position and velocity of the drop for both cases, i.e. from Cartecian coordinate to spherical one and from spherical one to Cartecian one, for every timestep. Therefore, I need a GENERAL expression or program of the coordinate transformation of the postion and VECTOR for a spray with arbitrary injection position and direction. Thanks again, Xiaofeng

Re: coordinate transformation?
(1). I am glad that you are still there. (2). Using the previous example, from (xp, yp, zp) you now have (rdistance, theta, alpha). From this location, you have a velocity vector (up, vp, wp) and also the gas velocity vector (u, v, w). (3). A vector is the one with a magnitude and a direction. They should remain the same in the old and the new coordinates systems, except that the direction will be measured in terms of the new shperical coordinates system. So, similar to the previous example, you can draw a geometric diagram and find the new components (newup, newvp, newwp), and (newu, newv, neww). (4). If you still have difficulty, try to do this on 2D problem first. I mean between (x,y), (rdistance, theta), (up, vp), (u,v), (newup, newvp), (newu, newv). (5). For arbitrary injector location (use translation), and orientation (use rotation), the difference is that you have to include additional steps in the process. It may not be obvious, but it should be fairly straight forward. I don't know whether there are general formula or programs available in this area. hope this will help.

All times are GMT 4. The time now is 10:28. 