Sound waves with attenuation

Just a simple derivation of the role of attenuation in the standard sound wave equation. Original work: Stokes, 1845.

Starting with the Navier-Stokes momentum equation

\frac{\partial }{\partial t} \mathbf{u} + \mathbf{u} \nabla \mathbf{u} = - \frac{1}{\rho} \nabla p + \frac{\mu}{\rho} \nabla^2 \mathbf{u} + \left(\frac{\lambda+\mu}{\rho}\right)\nabla (\nabla\cdot\mathbf{u}) ,

where \lambda is a Lamé viscosity coefficient. The bulk viscosity coeficient  is defined as  \zeta = \lambda + (2/3) \mu. The last term  is often neglected, even in compressible flow, but sound attenuation is one of the few cases where it may have some influence. All viscosities are assumed to be constant, but in this case this is a safe assumption, since we are going to assume small departures about equilibrium values.

Continue reading

Advertisements

Moving to python for science

OK, it’s final.

After some thinking, reading here and there, I have convinced myself to move to python as far as science is concerned.

One of the mean reasons is that there is this environment (“ecosystem” they call it), SciPy, in which my main concerns are answered.

  • How many times have I looked for information on a language only to find about something I don’t care about. Like address books, what’s up with those? SciPy goes straight to the point: linear algebra, plotting and analysis, symbolic analysis…
  • Already in the first lines, they are already discussing software I use: matlab, octave, emacs, xmgrace (one of the reasons of moving is the lack of progress in this fine 2D program)

Not long ago I wrote a list of scientific software that was interesting to have in linux. Now, if things go as planed I will only need:

GRAPHS

MATH, NUMERICS

MATH,SYMBOLIC

CFD

LIBRARIES

PROGRAMMING

  • SciPy
  • Not replaceable:
    • Good ole C and C++

PUBLISHING

  • LaTeX
  • emacs (don’t forget the AucTeX extension for LaTeX)

STATISTICS

Annotum, the future of scholarly publising

Annotum is “an open-source, open-process, open-access scholarly authoring and publishing platform based on WordPress.” This sound very interesting if you are into scholarly publishing, like the open-* ideas, and work with collaborators – or just work in different places.

It supports LaTeX, figure upload with captions, bibliography management (quite easy through DOIs), and I guess some other features that I have not explored. I am particularly interested in linking all sorts of files (e.g. data), and export capabilities (specially, into straight LaTeX).

This is the reference to a trial article I have written: Daniel Duque. A trial: Annotum trial [Internet]. Version 3. Annotum trial. 2012 Mar 16.

Lost pdf author and title with latex

¿Lost pdf author and pdf title? Just go ahead, edit the pdf file, and perhaps  (YMMV) you’ll find a readable section with the relevant info. Look for “\Title”. This happened to me while running latex + dvips -Ppdf  + dvips… the author and title info from the hyperref section was lost in the process (pdflatex seems work ok.)

The relevant section of my pdf:

<</Producer(dvips + GPL Ghostscript  9.0)
/CreationDate(Tue May 31 19:00:02 2011)
/ModDate(D:20111103111644+01’00’)
/Creator(gnuplot 4.4 patchlevel 0)
/Title(Proyecto Investigador)
/Subject(Proyecto)
/Author(Daniel Duque)
/Keywords(proyecto)>>endobj

 

 

vi, emacs quick macros

vi

Some may be used to the magical “.” (period) command in vi, which magically repeats “the last thing you did”. Since this last thing can be quite complicated, this is some kind of easy macro in practice. Imagine you want to add a period at the end of every sentence of a list. Simple: type “A-<esc>” (i.e. A-hyphen-escape key) on the first sentence. Then go j.j.j.j.j.j.j. like mad. You can also type “4.” to do the thing 4 times (not very useful in this case).

emacs

But you know all this if you use vi anyway (why do you use it otherwise?). What I guess many people don’t know is that emacs also has quick macros. Type “C-x (” (i.e. control-x open parenthesis) and read the warning “defining keyboard macro”. “Keyboard” means this is not defined in some other way (e.g. in a config file). Now, type your macro. In the previous case you could type now C-a, “-“, down-arrow. Them “C-x )” to end your macro. Notice this includes the “down-arrow”, which moves to the next line (C-n is a more traditional way to do this). Type now C-e to execute the macro once. Type C-n C-x to do it several times (n is a number).