I even thought of an example, try and follow me. Let's say there is a guy names John who likes to go on walks. Here is a schematic. Engineers like schematics. I'm not an artist, so its a simplification! Engineers are also organized, so for reference, this is Figure 1 (in case I request you remember it later, I will say, recall Figure 1)
Figure 1: John walking along
Now, lets say, because I am John's wife (is it really possible that I am somebody's wife?) I am interested in trying to speculate where John will be at a certain time knowing that he likes to walk. As a modeler, my first step is to come up with a set of equations I think will describe where John will be at a give time. Time to dust the cobwebs from your left brain for a minute and recall some basic physics (basic physics, I know its in that brain somewhere, I'll give you some time. . . .)
physics
physics
remember, newton, gravity?
OK, well, anyway, in physics we all learned about velocity and acceleration. Velocity is distance over time. So it describes how long it take something to get from point a to point b. Like the odometer in your car. Since I'm an engineer, and since I'm in Europe, I'm going to use metric units. Don't freak, they are actually easier to understand and place together than English Units. So I know that Johns walks with a certain velocity, X (m/s). In paratheses is the unit for the parameter. I am interested in knowing the distance, D (m) John is from his starting point. D is my state variable, it is the variable I am trying to accurately describe, or model. I know that X = D/t where t is time. So, a quick little manipulation leads to D = X*t. Distance (m) = Velocity (m/s) multiplied by time (s). So, if I can reasonable estimate John's velocity, I should be able to, given a certain time, determine his distance from his starting point.
Step two for a modeler is to gather some data to test the set of equations. So, one day, I set up an elaborate system of monitoring points to measure how fast, on average, he walks. For simplification (I think I mentioned we like to makes things simple!), lets say that John has a rare disorder which forces him to only be able to walk from the west to the east. Only west to east, no straying, no bends, no curves, a perfectly straight line. After my day with elaborate measurements, I find that John walks constantly at a rate of 1 m/s. So now, I have a data set, hooray! When I say I am going out into the field, when I go sampling, I am collecting data from the river to use to test my set of equations.
The third step is to test my model to see if it works. I write my model using computer code, so when I write it, it will look like this
deltat = t/n
DO i = 1, n
D(i) = D_start + X*deltat
END DO
What? OK, I'll back up a minute. This is a 'do loop' So, I am telling the computer to do what is between DO and END DO n times, starting at 1 and ending at n. n is the number of time steps I would like to model during the time i am interested in. So, for example, if t = 20 secs, I can model what happens every 1 sec (deltat=1 and n will be 20), or every 2 secs (deltat =2 and n will be 10) and so on. The smaller my time step, the more accurate my model will be. Inside the loop, the computer will calculate and store the distance John is from the starting point at each time step. It calculates the new distance by adding to the old distance the velocity multiplied by the length of the time step. So, as an example, if X = 1 m/s, deltat = 1 sec and D_start = 0, then the following would be the result:
i D(i)
0 0
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
10 10
11 11
. . . . . . etc
OK, well, that ends lesson 1 of why I'm in Granada. Let me know if you have any questions!
physics
physics
remember, newton, gravity?
OK, well, anyway, in physics we all learned about velocity and acceleration. Velocity is distance over time. So it describes how long it take something to get from point a to point b. Like the odometer in your car. Since I'm an engineer, and since I'm in Europe, I'm going to use metric units. Don't freak, they are actually easier to understand and place together than English Units. So I know that Johns walks with a certain velocity, X (m/s). In paratheses is the unit for the parameter. I am interested in knowing the distance, D (m) John is from his starting point. D is my state variable, it is the variable I am trying to accurately describe, or model. I know that X = D/t where t is time. So, a quick little manipulation leads to D = X*t. Distance (m) = Velocity (m/s) multiplied by time (s). So, if I can reasonable estimate John's velocity, I should be able to, given a certain time, determine his distance from his starting point.
Step two for a modeler is to gather some data to test the set of equations. So, one day, I set up an elaborate system of monitoring points to measure how fast, on average, he walks. For simplification (I think I mentioned we like to makes things simple!), lets say that John has a rare disorder which forces him to only be able to walk from the west to the east. Only west to east, no straying, no bends, no curves, a perfectly straight line. After my day with elaborate measurements, I find that John walks constantly at a rate of 1 m/s. So now, I have a data set, hooray! When I say I am going out into the field, when I go sampling, I am collecting data from the river to use to test my set of equations.
The third step is to test my model to see if it works. I write my model using computer code, so when I write it, it will look like this
deltat = t/n
DO i = 1, n
D(i) = D_start + X*deltat
END DO
What? OK, I'll back up a minute. This is a 'do loop' So, I am telling the computer to do what is between DO and END DO n times, starting at 1 and ending at n. n is the number of time steps I would like to model during the time i am interested in. So, for example, if t = 20 secs, I can model what happens every 1 sec (deltat=1 and n will be 20), or every 2 secs (deltat =2 and n will be 10) and so on. The smaller my time step, the more accurate my model will be. Inside the loop, the computer will calculate and store the distance John is from the starting point at each time step. It calculates the new distance by adding to the old distance the velocity multiplied by the length of the time step. So, as an example, if X = 1 m/s, deltat = 1 sec and D_start = 0, then the following would be the result:
i D(i)
0 0
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
10 10
11 11
. . . . . . etc
OK, well, that ends lesson 1 of why I'm in Granada. Let me know if you have any questions!
2 comments:
Laura,
Oh...so THAT'S what you do!!! Seriously, I am so glad you are keeping this blog. For all of us who love you it's a great way to find out what you are doing on the other side of the world.
Take care,
Nancy
Why did you have to go and do this, Laura? Now people are going to start bugging me to explain what I do for a living and, since it is nowhere as cool as what you do for a living, I am going to feel totally lame! ;)
Post a Comment