Wednesday, February 13, 2008

Snow desert and interpolation problems

The winter is as harsh as it can be here in Ann Arbor. The city seems like a snow desert, in a sense that instead of sand being blown by the winds, you can see small particles of snow almost creating moving dunes of snow. Temperature has never ben so low. Sunday the temperature reached the -30oC, and we had winds of 60km/h and sometimes even surpassing the 100km/h. Of course, I just stayed quiet at home. At this moment, it is windy and snowing outside, and I am sure all the transportation system in the city is disrupted. I am still at the University, just gathering my courage to go outside and endure this "warm" weather (-20oC) while I wait the bus. And the adventure continues!! I love this place, and this cold!! :P

I guess I finally understood why the program I was modifying to calculate the line profiles I seek so vehemently is not working. One week ago I finished my modifications, and I was sure that after those modifications the code had to work perfectly, but it did not. So I spent the rest of the week trying to figure out why in the name of the Infinity Layers of the Abyss that god forsaken code was not working!! Just looking at my results I could figure out the problem was in the optical depths of each of the rays (the optical depth is a measure of how deep you can see a ray of light before the medium becomes opaque). The optical depth was becoming too large inside a region where it was not expected to be so large. Large optical depths mean one thing, and it means that the atomic level population densities where not being properly calculated.

I started to track the values of the population densities where the optical depth was becoming too large, and then I found something unusual. To calculate the optical depth between two points I have to calculate an integral between these points, and to calculate this integral I need the population densities in these two points. If I have two points very near, I don't expect the population densities to be very different, and what is happening is that near the edge of my wind the difference between these values for these two nearby points is very large (something like 10000 times from one point to another). And that was the reason why the optical depths are becoming too large in a very low density regions where they should be very, very, very small (instead of being something like 0.001, the values are something like 100, and it means that the ray is not able to cross a region where otherwise should be almost transparent).

Diving deeper in this problem I realize that the problem was in the interpolation function that was called by the program. The problem was that I have not changed that, so if the program was working before, it should be working now, but I decided to verify anyway. And after some debbuging, I could not find anything wrong with that. All the physical quantities being calculated by that function were correctly calculated. The grid file I have calculated to used as an input to this program was also perfect. Then I remember the flux program needs a input that is a little different from the one I give him, and to get this grid file I have to use another interpolation subroutine in IDL. I looked at this other grid file, and there was the cursed error!! The problem with the population densities appear just after I use the IDL program to re-grid the original grid file. There is a strange function it uses to interpolate called "Triangulate" that is causing this problem. I have no idea how this function works, but the problem surely is due to the fact that the problematic region is exactly in the border of the wind, and borders are usually problematic regions.

Now I just need to figure out how to solve this interpolation problem... And I don't think it will be easy... And my time keeps running out... 27 days left...

2 comments:

MegMarques said...

Brrrr, que horror esse frio!
Só pra te matar de inveja: ontem no centro de BH estava 38 graus.
Um sol de desidratar camelos...
bjo

Thiago said...

Cara! Tá fudido!!! hehehe...

E sim...tava 38oC... um inferno!!! argh!!!