Tuesday, September 16, 2008

1. The Material Derivative in Cartesian Coordinates

Recently, we've had some controversy about some terms in a momentum equation in one of the papers that one of my colleagues is studying. Indeed, for compressible and non constant viscosity fluids, it is not straightforward to come up with the equations of motion as this situation is rarely the case in our daily engineering investigations.

As the problems we are dealing become more complicated (in fact, we add the complication as we solve the problem one step at a time. For example, we start with an inviscid incompressible model, then we add viscosity, then we add compressibility to the inviscid model, then add viscosity to the compressible model etc...).

So anyway, I decided to once and for all settle down the issue and put together a convenient and easy to understand post.

The Material Derivative

First, let us start by going over the material derivative one more time. As you most probably know, there are two reference frames that can be used in studying fluid motion; namely, the Lagrangian and Eulerian frames.

In the Lagrangian description, each particle in the fluid is followed as if it were a "rigid body". This means that each particle has a unique identifier or tag. This description is akin to rigid body dynamics and is a great way of describing a relatively small number of particles. However, when dealing with a fluid, there is a very large number of particles thus rendering a Lagrangian description of a fluid flow problem very tedious and intractable.

In the Eulerian description, flow properties (velocity, pressure, temperature, etc...) are defined as a function of space and time. This means that instead of tagging each particle of the flow, the viewer fixes a volume in space and identifies the flow properties in that region of space. Therefore, it does not matter which particle passes through the volume since that particle will assume the flow property of that point in space.

The natural way of defining the velocity or acceleration is based on a Lagrangian description because it is the easiest (and that's how we've done it in dynamics in high school)! When it comes to fluid flow, the acceleration of a fluid particle as seen in the Eulerian reference is different from the Lagrangian description. This is due to the fact that as the particle moves about, its velocity and position change as well. In Mathematical terms, the particle velocity is


of course, the velocity is a vector



Now the accelerationo is obtained by differentiating the velocity with respect to time. But since the velocity is a function of the position, and the position is a function of time, then we have to use implicit or chain rule differentiation as follows

(Eq. 3)

which yields the following expression for the acceleration of ANY fluid particle as seen by an observer in an Eulerian reference.

If we were in a Lagrangian frame, then the velocity is only a function of time because in that reference, the observer is riding on the particle as it flows through space.

[Next Article: The Material Derivative in Cylindrical Coordinates]

Cite as:
Saad, T. "1. The Material Derivative in Cartesian Coordinates". Weblog entry from Please Make A Note. https://pleasemakeanote.blogspot.com/2008/08/derivation-of-navier-stokes-equations.html

Monday, September 15, 2008

How to Disable the Firefox Site Specific Zoom

Firefox 3.0 has the ability to keep track of the zoom level you have chosen for a given website. To cancel this feature do the following
  1. Type about:config in the Firefox toolbar
  2. Locate browser.zoom.siteSpecific
  3. Double click on that entry to change value from "true" to "false"
Voila!

Thanks to My Digital Life for sharing this info.

Cite as:
Saad, T. "How to Disable the Firefox Site Specific Zoom". Weblog entry from Please Make A Note. https://pleasemakeanote.blogspot.com/2008/09/how-to-disable-firefox-site-specific.html

Firefox Blurry Images

Reset the zoom level for that domain
Ctrl + 0 (zero)
I recently faced a weird issue with Firefox. All the images on my blog were rather blurry as if they were wrongly scaled. So I tried with a new Firefox profile and it worked fine. So there must have been some setting or some add-on that is part of the current user profile that is causing this. I removed all the extensions and add-ons to no avail. Just moments ago, I found the solution on the Blitz Research forum. It turns out to be an issue related to the zoom level for a given website, which Firefox 3.0 remembers. By clicking Ctrl + 0, you reset to the no zoom.

Cite as:
Saad, T. "Firefox Blurry Images". Weblog entry from Please Make A Note. https://pleasemakeanote.blogspot.com/2008/09/firefox-blurry-images.html

Tuesday, September 9, 2008

How to Post Math Equations in Blogger Using Latex

In a previous post, I discussed how to post math equations in blogger using the ASCIIMathML script. The advantage of using this method is that you are not dependent on any external server to host your equations since they are NOT images. ASCIIMathML displays equations in ASCII format, i.e. in plain text format.

The bottleneck of this method, as I discovered later on, is its limited capability to display some complicated mathematical forms. The famous example is the limit as x goes to zero. This is how it looks using ASCIIMathML

$\lim_{x\rightarrow 0}$

I was glad to find these limitations before engaging in posting topics related mathematics. It would have been a mess to go back and forth and convert equations etc...

The method that I will discuss today is an old technique that I passed upon when I first started this blog, but had completely neglected. It uses LaTeX to display equations. Of course, this is a good sign. But how does it work? Very simple.

There is a server somewhere over the internet that has "software like" capabilities, i.e. it can process user requests dynamically. These capabilities include Perl,PhP, ASP etc...

On this server, there would be an application that takes a LaTeX syntax as input, processes it on the server, and converts it to an image on the fly.

Voila!

But where is that server? Who wrote that application? Where are the images hosted? Will the application be there, forever?

One question at a time.

Where is that server?
There are several servers out there, the ones I know of are http://www.codecogs.com/ and http://www.forkosh.com/ (which uses mimeTEX).

Who wrote that application?
One, two, or more programmers.

The CodeCogs application was written by Will Bateman and Steve Mayer and can be accessed at:
http://www.codecogs.com/gif.latex?

The mimeTEX interpreter was written by John Forkosh and can be accessed at:
http://www.forkosh.dreamhost.com/mimetex.cgi?

Where are the images hosted?
On the server, temporarily. Due to the dynamic nature of the LaTeX interpreters, they are converted to an image whenever a webpage posts a request. For example, whenever you load a page that has an equation, the server immediately interprets that equation, converts it to an image and sends back that image. I assume that there would be a cached version of the image on the server that is deleted after some time.

Will the application be there forever?
I hope so! The only alternative is to host that application yourself, on your own server. But hey! Can you make sure that you will be able to pay for that hosting for the rest of your life? This dependence on an external server is no different than our depends on google. As for the equations, I am currently hosting them on Picasa, which is basically like hosting the equation on an external server. But, remember, all you need is the application that interprets LaTeX, not the images! So, in the event that one of these applications disappears, you can very simply point to another application on some other server. It is very simple as you will see shortly.

So how does it work in blogger?

You simply create an img tag and set the source of the image as the location of the application followed by the LaTeX syntax. Here's an example. Let's say you want to write this equation


\large e^x = \sum\limits_{n = 0}^\infty {\frac{{x^n }} {{n!}}}
The LaTeX syntax is

e^x = \sum\limits_{n = 0}^\infty {\frac{{x^n }}{{n!}}}

create an img tag with the appropriate src field pointing to the online LaTeX renderer and then insert the LaTeX code, i.e.

<img src="http://www.codecogs.com/gif.latex?e^x = \sum\limits_{n = 0}^\infty {\frac{{x^n }}{{n!}}}" />
Voila!

Of course, this is a mess! If everytime you want to write an equation you have to write down the img tags and insert the path to the LaTeX renderer... that is very inefficient!

Fortunately, there are several ways to overcome this. The first one, thanks to the guys at codecogs, their online LaTeX editor prepares the img block for you. All you have to do is
  1. Go to the codecogs online LaTeX editor
  2. Type in your equations LaTeX
  3. Copy the HTML code that is generated at the bottom of the page
  4. Paste it in Blogger (either in the "Edit HTML" or "Compose views).
Voila!

After the equation is displayed, you can align it the way you want using the options provided by the blogger editor. The images generated by the codecogs LaTeX editor are transparent with a black foreground. In case your blog has a dark background, they won't look nice at all. What you have to do in this case (which is what I am doing on this blog) is create a new class for images that has a white background. Here's what you need to do
  1. Go to your blog's Layout
  2. Click on "Edit HTML"
  3. Place your class somewhere before ]]> </b:skin >
  4. Define your new class as follows:
    img.latexEquation {
    background:white;
    margin: 0px;
    padding: 5px;
    }
  5. When you paste the HTML code from codecogs, specify which class is applied to the image as follows:
    <img class="latexEquation" src="..."/>
Voila!

Now your equations will have a nice white background behind them.

Alternatively, you can use the mimetex editor which gives you the option to make an opaque background and reverse the colors for blogs with a dark background. Make sure you specify \opaque for an opaque background and \reverse for a white foreground. \reverse\opaque will set a black background and white foreground. Here's how it looks with the \reverse\opaque setting



and with the \reverse only




[To be continued...]

Cite as:
Saad, T. "How to Post Math Equations in Blogger Using Latex". Weblog entry from Please Make A Note. https://pleasemakeanote.blogspot.com/2008/09/how-to-post-math-equations-in-blogger_06.html

Wednesday, September 3, 2008

How to Rip a DVD into AVI

For future reference, I am making this post to remind myself how to backup my DVDs, especially after my hard drive crashed last week. This method is based on this excellent post.

The idea is to backup or rip a DVD into an AVI. Here's what you need first
  1. Download DVD Decrypter
  2. Download Auto Gordian Knot
As discussed in the original post, DVD Decrypter will remove any encryption that is embedded into the DVD.

Auto Gordian Knot, aka AutoGK, is a set of tools that will allow you to convert the decrypted DVD into an AVI. Don't worry, AutoGK has a single GUI where you specify the parameters for your conversion.

After installing DVD Decrypter and AutoGK, do the following
  1. Open DVD Decrypter
  2. Go to: Mode/IFO


  3. In the information files list to your right, select the item that is the longest in case of a movie. In case of TV show, select the episode of interest.


  4. Select the folder location of your decrypted DVD

  5. Finally, click on the decrypt button (with the green arrow)
Depending on the length of your DVD/episode and your platform, it usually takes less than 30 minutes to rip a 150 minutes DVD. When the decryption process in complete open up AutoGK and do the following
  1. For your input file, choose the first VOB file in the extracted directory
  2. Set the name and location of the output AVI
  3. Select the first audio track
  4. Select a subtitle (if any)
  5. Select the output size. Usually, a 120 minutes DVD converts well to 700 MB. For 30 minute TV episodes, I would choose 175 MB while for a 1 hour episode, i would choose 350 MB. Alternatively, you can set the quality percentage. I find this the fastest way as AutoGK will perform a single pass. I usually keep this setting at around 65%
  6. Click on advanced settings and choose Xvid and set the audio to VBR MP3 at 128 kbps . Note that you may need to download XviD (or DivX)
  7. Click on add job
  8. Click start
Voila!

Cite as:
Saad, T. "How to Rip a DVD into AVI". Weblog entry from Please Make A Note. https://pleasemakeanote.blogspot.com/2008/09/how-to-rip-dvd-into-avi.html