concept this exercise in category fortran

appears as: this exercise
Modern Fortran: Building efficient parallel applications

This is an excerpt from Manning's book Modern Fortran: Building efficient parallel applications.

Try to solve this problem with pen and paper. After you’ve worked through the exercise, you’ll have solved the linear advection equation, even if you didn’t realize it. The advection equation predicts the change of any quantity due to the spatial gradient of that quantity and the background flow. We’ll do the exact same calculation to predict the motion of the object in our simulator. You can find the solution to this exercise in the “Answer key” section near the end of this chapter.

Figure  7.3. Locations of the nine weather buoys in the Gulf of Mexico used in this exercise
gom buoy map

Consider the following scenario: You’re fresh out of school, or perhaps ready to move on to the next step in your career. You’re looking into a number of cities around the world to live in: Seattle, New York City, Miami, London, Mexico City, and a few others. For many people, myself included, weather is an important factor for a place to live, especially if you’re looking to settle down and build a nest. In this exercise, we’ll process a relatively long weather dataset and look for the most pleasant climate to live in. I know, this is subjective, but bear with me for the sake of this exercise.

To be fair, these are quite crude and arbitrary criteria, but they will do for the sake of this exercise. For each city, we’ll calculate the score for each of the four variables: temperature (the higher the better), humidity (the lower the better), wind speed (the higher the better), and the clear sky frequency (the higher the better). The total score is simply an arithmetic average of the four specific scores. I’ll defer the interpretation of these scores to the end of the exercise later in this chapter. At the end, we’ll end up with a neat little score table like this, showing the results of our final weather averaging program:

City | Temp. | Humidity | Wind  | Clear | Total
 Code | Score | Score    | Score | Score | Score
 -----+-------+----------+-------+-------+------
 EGLL   0.02     0.04     1.00     0.97     0.51
 LAX    0.45     0.14     0.72     1.00     0.58
 LYBE   0.15     0.13     0.80     0.05     0.28
 MIA    1.00     0.00     0.77     0.86     0.66
 MMMX   0.41     0.57     0.68     0.47     0.53
 NYC    0.10     0.13     0.00     0.41     0.16
 OIII   0.55     1.00     0.63     0.41     0.65
 SEA    0.00     0.10     0.86     0.58     0.39
 SKBO   0.14     0.01     0.50     0.00     0.16
 ZGSZ   0.90     0.03     0.80     0.27     0.50

The city code is the unique international code for each weather station. The cities are: London, United Kingdom (EGLL); Los Angeles, California (LAX); Belgrade, Serbia (LYBE); Miami, Florida (MIA); Mexico City, Mexico (MMMX); New York City, New York (NYC); Tehran, Iran (OIII); Seattle, Washington (SEA); Bogota, Colombia (SKBO); and Shenzhen, China (ZGSZ). I chose these ten locations for this exercise; however, if you want, you can follow the direction from the previous subsection and download data for your location, or as many other locations as you want.