Pages

Saturday, January 30, 2010

There's a short article with a neat set of flow-viz pictures and a movie on the APS site. It's kind of funny how research results get written up in the popular press.

As a demonstration of the chemistry "tail" wagging the fluid dynamics "dog," researchers have...

Although this chemically-induced convection was not a surprise, the convection patterns in the simulations were surprising. In some cases the convective plumes went only upward from the boundary, rather than creating a symmetric pattern that sent fingers both up and down from the mid-line.

It turns out that even without a chemical reaction, convection would be expected if the reactants had different diffusion rates.

The new simulations show that convection makes the reactions progress faster, just as stirring would.

I'm not sure how surprising any of that would be. Turbulent mixing is a well known way of increasing reaction rates, for instance in flame-holders and high-g combustors. It's also kind of funny how everything has to do with climate change:

This could mean that researchers have underestimated reaction and mixing rates in natural phenomena, like the Earth's mantle and supernova explosions, as well as for carbon sequestration, in which carbon dioxide is stored underground. Modelers have so far not considered how convection induced by the interaction of carbon dioxide with ground water may affect the long-term containment of this greenhouse gas...

Friday, January 29, 2010

I was putting together a little data post-processing tutorial for some guys in my lab, and it turned into a tour de force for that scientific computing swiss army knife, the FFT. So I figured I'd share it here.

The explicit recognition of its [the FFT’s] importance is one of the few significant advances in numericalanalysis in the past few decades. Much has been learned about various aspects of computation, but no otherrecent discovery has so profoundly affected so many different fields as has the fast Fourier transform. –R.W. Hamming [1]

This tutorial will demonstrate Gaussian convolution / deconvolution and Abel inversion of something resembling microwave interferometry data. The tutorial uses Scipy[2], but the concepts (as well as most of the function names and even the underlying FFT libraries) transfer directly to other environments (Matlab, Octave, etc). When in doubt, Google or Hutchinson [3] are your friends.

1 Gaussian Convolution / Deconvolution

The Microwave Interferometer beam is assumed to have a Gaussian distribution of intensity. The equation for a Gaussian distribution is

(1)

This means that the measurement at each spatial position is a “mixture” of effects from neighboring areas along the beam’s axis. To understand this, we’ll do some convolutions with Gaussians. First off, we need an array of points
from a Gaussian, but we need them in a particular order. Here’s a Python function which does what we need:

The reason for reordering is because we’ll be using FFTs to do the convolutions, and the FFT assumes periodic data. Figure 1 shows the results for several values of the standard deviation.

Figure 1:

Reordered Gaussians

Once we have the proper distributions defined, the convolution just requires an FFT of the theoretical curve, and the Gaussians, point-wise multiplication in the transformed-domain, followed by an inverse transform. The Python to do this is shown below:

Convolution is easy enough, but what we have in the case of an interferometry measurement is the convolved signal, and we’d like the ’true’ measurement. We can get this by deconvolution. This is simply division in the frequency space as opposed to multiplication:

Figure 3 shows the results for a couple test σ’s. Unfortunately, deconvolution is numerically ill-posed and very sensitive to noise, it tends to amplify any noise present. Unless we are very lucky and guess the exact σ and our measurement has no noise, we end up with ’wiggles’.

Figure 3:

Deconvolution of σ = 6 ’measurement’

We can fix things by first ’smoothing’ with a small Gaussian, and then performing some test deconvolutions.

The deconvolution that uses σ > σtrue still displays overshoots even with the smoothing, it also becomes too ’sharp’. The calibration measurements can be used to find the optimal smoothing and sharpening σ for the particular interferometer / frequencies being used.

2 Abel Inversion

Many of the same tools presented in Section 1 can be extended to the calculation of the Abel inversion. In microwave interferometry we have a ’chord-averaged’ measurement, but we would like to understand the radial distribution of the quantity (phase shift / plasma density).

(2)

where F is our chord-averaged measurement, and f(r) is the radial distribution that we would like to recover. To calculate the inverse transform we first need an estimate of the derivative ∂F∕∂y. Like deconvolution, numerical differentiation tends to amplify noise (numerical or otherwise). To avoid this we can convolve the derivative of a Gaussian with the function we wish to differentiate and then perform an inverse transform to recover a ’smoothed’ numerical derivative. The derivative of the Gaussian is

(3)

A Python function that gives a properly re-ordered first derivative is

The one minor ’gotcha’ is dealing with the integrable singularity in 2. We just copy the value of the nearest neighbor over the Inf, the integral will approach the correct value in the limit of small Δx (lots of points).

Figure 6:

Inverse Abel Transform Results

The analytical inverse Abel transform of the theoretical phase shift curve can be easily calculated (Maxima [4] script shown in section A.2). The theoretical phase shift has the form

(4)

which gives the derivative as

(5)

and finally, the inverse Abel transform as

(6)

2.1 Centering

Often, despite our best efforts, the data are not centered. There is a method to estimate the optimal shift required to center the data using the FFT [5]. Figure 7 shows one of the “measurements” shifted by a small amount.

Where Lnh is the Fourier transform of the data, and mkΔ is a shift. Since the data is real, the real part of its transform is the even part of the signal. The shift which maximizes the magnitude of the even part is the one which makes the data most even (centered). A graphical analysis of the data can provide a range of shifts to try. The Python to perform this maximization is shown below (this relies on being able to index arrays with arrays of integers, which can be done in Matlab as well).

Figure 8 shows that the objective function (equation 7) reaches a local maximum at the shift which was originally applied (shown in Figure 7).

Figure 8:

Centering Objective Function

3 Calibration Model Fitting

The techniques presented in section 1 can be combined to fit a calibration model to interferometry measurements of a calibration cylinder (or any other object for which you have the theoretical phase-shift curve). The purpose of a calibration model is to provide estimates of parameters like the standard deviation of the Gaussian beam for use in deconvolution and inversion of subsequent test measurements.

The error in the fitted model following this approach is shown in Figure 9. Both the least squares error and the min-max error methods recover the correct deconvolution σ.

Figure 9:

Error in Calibration Fit

4 Further Improvements / Variations

Jaffe et al. [5] also suggest “symmetrizing” before calculating the Abel transform by removing the imaginary component of the transformed data. They also estimate the variance of the inverse Abel transform based on both the portion of the data removed by filtering (smoothing) and symmetrizing.

Rather than calculating the derivative necessary for the inverse Abel transform with a convolution, a pseudo-spectral method could be used. The trade-off being that very accurate derivatives could be attained at the expense of greatly amplifying any noise. A more practical variation, that is not susceptible to noise, would be to calculate the integral with a pseudo-spectral approach rather than the composite trapezoidal rule. This would give a more accurate integral, and bring the numerical and analytical curves in Figure 6 into closer agreement.

A Complete Scripts

A.1 Python

The complete Python script to do all of the calculations and generate all of the plots in this tutorial is available.

A.2 Maxima

The Maxima batch file used to calculate the inverse Abel transform of the theoretical phase-shift curve is available.

Thursday, January 28, 2010

The Orlando
Sentinel (1/28, Block) reports, "Administration officials and a former
astronaut on Wednesday called President Obama's plans for NASA 'exciting' and
'bold,' saying he was replacing a failed moon program with a new $6 billion
project to develop commercial rockets capable of taking astronauts into orbit."
The plan, described by an unnamed White House and NASA official and Augustine
Commission member Sally Ride, would see an annual increase to NASA's budget over
the next five years. At the teleconference, the "NASA official stressed that
just because the Constellation program to return humans to the moon and its Ares
I and Ares V rockets were going to be canceled did not mean that the Obama
administration was abandoning exploration and human spaceflight." However, when
questioned, "officials repeatedly dodged the question of what plans the
administration had for a heavy-lift
rocket."

However, Florida
Today (1/28, Halvorson) notes "Obama's space plan will be a hard sell in
Congress. Even ardent Obama supporters and some key space advisers are taken
aback." Sen. Bill Nelson warned the plan would "decimate the space program,"
while Rep. Bill Posey called the plan a "slow death" for NASA's manned
spaceflight program. In contrast, the unnamed NASA official said it was a
"serious, serious effort" to reduce the manned spaceflight gap after the shuttle
program ends. The St.
Petersburg Times (1/28, Leary) notes in an article about the reaction
to Obama's State of the Union address, reports Nelson said, "On the downside,
we're going to have to get the president to do more for NASA. America's global
leadership in science and technology is at stake if we don't maintain a more
robust space exploration
program."

Meanwhile, FOX
News (1/27, Clark) reports, "Marty Hauser, vice president of Washington
operations for the Space Foundation, an advocacy group, said that while the
proposal would hurt in the short term, it does have the potential to create jobs
in the long term if the objective is to privatize space flight." However, the
article notes "Republican lawmakers wasted no time in blasting the president."
Industry leaders also reportedly "expressed dismay" over a potential budget
freeze for NASA, according to some previous reports. Louis Friedman, executive
director of the Planetary Society, said, "I think NASA's value as an economic
engine for the country is long understood in theory, long underplayed in
Congress.

Bolden Discusses NASA's Future In Israel.
In an article titled "'An Israeli Astronaut? There May be No More Astronauts At
All!,'" the Israel
National News (1/28, Kempinski) posted a video of NASA Administrator
Charles Bolden speaking to the press at the Ilan Ramon International Space
Conference. "Bolden related to a number of exciting topics in the field of
space and beyond. In the following video the NASA Chief discusses the option of
sending another Israeli astronaut into space, the mission of saving the planet
from asteroids, and commercial flights to the
moon."

End Of Constellation Raises New Questions.
Popular
Mechanics (1/27, Pappalardo) gives "a breakdown of the some questions
to ask during the aftermath of the apparent collapse of the United States' human
space flight program." These include questions like who would benefit from the
shift in NASA budget priorities, whether the Defense Department will be the
"heir" to NASA, and if astronauts are "going extinct" among others.
Furthermore, "Without the appeal of a human flight program, will fewer aspiring
scientists and engineers be lured into the agency and towards military and
private space? Will the research end of NASA suffer from this lack of
inspirational purpose? What are the geopolitical ramifications, if any, of this
waning of American
power?"

So, for example, the rate of construction depends on the amount of discovered oil that’s been through the fallow stage, the amount of final extraction depends on how much has gotten through each of the proceeding stages. A really convenient way to calculate convolutions is with the FFT, because convolutions are just multiplications in the transformed space. The advantage of an FFT-based approach is the (n log n) scaling of the computational cost (rather than the (n2) scaling of a loop-and-multiply implementation). The draw-back of using an FFT-based convolution is that the FFT assumes the data is periodic, so you need plenty of zero-padding to prevent weird wrap-around effects. The Python to do the required convolution and calculate the simple model is shown below.

The Other Place spokeswoman Tina Patterson said the decision to integrate them into the neighborhood is not a new concept but was done quietly this time because of the stereotypes associated with the chronically homeless.

What stereotypes could those be?

Olds, Inman and Richard Miniard have been problems for the city the last nine years, police reports show.
They are regarded by police and business owners near Brown and East Stewart streets as nuisances and drunks who panhandle illegally for money.
Each have been convicted numerous times of being drunk in public. Another resident in their complex, John C. Hibbits has been arrested more than 50 times, police records show.
All the men said they abandoned shelters because of the rules, opting instead for dirty tents erected in Veterans Park.

Your tax dollars paying their rent now. I guess when the public drunkenness and urination is college-age buffoons it's ok, but when it's homeless old guys it's bad for business. That's alright, relocating them into an unlicensed group-home provides a nice, no-risk cash flow for the new property owner, and roofs over the heads of some homeless folks (who have been unfairly stereotyped). Everyone's happy right? Everyone but the people who now have to live with these pan-handlers (who couldn't be bothered to follow the rules so that they could stay in a shelter). I must say that not all of them were bad, I remember one in particular that made it a point not to ask for money when you passed him on the sidewalk, he was trying to make the best of his new opportunity. Unfortunately, his fellows did not emulate his good attitude.

“It was never our intention to have them thrown out of our neighborhood,” said Cheryl Bates, president of Grafton Hill Neighborhood Association. “We were never made aware of their arrival until we read it in the newspaper. Then we started seeing panhandling, public urination and fights involving people living in that building.”

I really feel for the poor guy who happened to be living in the same building that they dumped a dozen reprobates on:

Gary Ewing, who was living in the apartment before the formerly homeless tenants arrived, said he noticed a lot of “bizarre” things once his new neighbors arrived.
“I kept calling police because they’d bust out all of the windows and would be drunk and harassing me,” Ewing said. “Now they are not renewing my lease because I called police about all of this nonsense.”

The DDN article also has a quote from Gary Zaremba, who purchased the 16 unit apartment building on 2 Jun 2009 for $106k, and then had 10 state-funded tenants delivered into his lap a month latter (talk about a great real-estate speculation, what a talented fellow). [Update: a little birdie told me that he charges ~200% the market rate for his subsidised tennants, and he is not renewing the market rate tennants, $550/month * 10 = $5.5k/month state-guaranteed income for this guy without ever having to advertise to fill the vacancies in his newly bought building] I find it interesting that the guy who bought this old nearly empty apartment building (which was on a 'wouldn't it be nice to demolish this nuisance' list) just shortly before the relocation would blame this on the race of people in Grafton Hill:

“I think the big issue here is a lot of the (Grafton Hill) complaining came from whites with better incomes,” said New York-based property owner, Gary Zaremba. “The tenants living in the building weren’t violent felons. (The neighbors) just didn’t want my tenants living in their backyard.”

Hello! Lots of the pan-handlers you relocated are white! And the poor guy you dumped them on is black! GHA has all sorts of members (with widely varying amounts of melanin in their skin). You would have known that if you had come to a meeting when you bought property in our neighborhood. Now I understand why it is so easy for demagogues to rile people up about out of town speculators and carpetbaggers. If that's what economic stimulus brings to Dayton, you can keep it.

I think the worst thing about fly-by-night programs like this is when the stimulus funds run out, these old guys will be right back out on the street looking to scratch together enough petty cash for their next fix, and their patrons will have moved on to using some new issue or group as a 'project' to solidify political capital. If we were serious about helping these guys, we wouldn't have dumped them in an unsupervised mess with no structured 'program' to help them 'reintegrate'.

Their "top priority recommendation" is about Verification, Validation and Uncertainty Quantification:
• Our top priority recommendation is that a V&V and
UQ program for nuclear systems’ simulation take a
two-pronged approach.
• First, focus on research into the critical issues
and challenges
• Second, a concurrent study using the V&V and
UQ process to analyze a number of critical,
integrated physics applications would provide a
problem focus and address the issues of
coupled multi-scale physics and UQ.

If you care about having useful models, then you care about VV&UQ. Otherwise, a model just provides the colorful marketing material you use to garner more funding. Larzelere goes on to say,

It is Important to Note That Advanced Modeling and Simulation Does Not Replace the Need for Theory or Experiments

As an aside, I thought this graphic comparing the manpower and flops requirements of the two different simulation domains was interesting too.

Monday, January 25, 2010

White House Reportedly Will Fund Commercial Spaceflight.

The Wall
Street Journal (1/25, Pasztor, subscription required) website reports
that the White House has chosen to fund private companies to take astronauts
into space with a program likely to cost $3.5 billion over five years.
According to the article, Congress is expected to challenge this because of
safety concerns. Even though the article predicts conflicts because it will
shift money from existing programs to commercial companies, it also contends
there will not be any major program
cancellations.

Meanwhile, in continuing coverage, Space
News (1/23, Klamper, subscription required) reported NASA, according to
unnamed sources "will not be getting the $1 billion budget boost civil space
advocates had hoped to see," but the fate of the Ares I is still unknown.
However, the Orion capsule would not be cancelled, according to the sources.
"While Obama's funding proposal deviates from the Augustine panel's push for a
spending increase, sources said NASA's 2011 budget request is expected to align
with the panel's so-called Flexible Path plan." According to the article, "In
hindsight, NASA officials say the agency set Ares 1 and Orion on an
unsustainable spending
trajectory."

Space Frontier Foundation Chairman Sees Killing Ares As "Clear" Choice.
In an op-ed for the Orlando
Sentinel (1/23), Bob Werb, chairman of the board of the Space Frontier
Foundation, called for the cancellation of the "boondoggle" Ares I rocket
program. It is "just pork dressed up as cost-effective human space
transportation; it's not just wasteful, but destructive to future space
exploration beyond Earth orbit." Werb believes there is an "overwhelming" case
against the rocket, which he saw as a "bailout" for shuttle companies. "The
commercial alternatives are based on well-tested, mature systems currently used
to launch U.S. military, scientific and commercial satellites. Adapting these
rockets to carry people is cheaper, faster and better." Werb saw this as a
simple and "clear"
decision.

Food fight's on!

I'm a little unclear on how you can call spaceflight whose only customer is the government "commercial" though...

In related news,

Bolden To Reveal NASA Budget In Press Conference Next Week.

Space
News (1/26, Klamper, subscription required) reports, "NASA
Administrator Charles Bolden will unveil the U.S. space agency's spending
priorities for 2011 during a Feb. 1 press conference at NASA headquarters here,
according to administration officials." The article notes Bolden is also
"expected to discuss long-awaited details of the president's funding proposal in
the morning, followed by a press conference hosted by the White House Office of
Science and Technology Policy (OSTP) to rollout Obama's research and development
priorities - including those that affect NASA goals and funding- for the coming
budget year, these sources said." The budget is "expected to realign NASA's
human spaceflight activities and investments to foster development of commercial
systems." Bolden "tentatively" scheduled to conduct another press conference at
the National Press Club the following
day.

According to Spaceflight
Now (1/25, Clark), the budget "is expected to include new direction for
NASA." A White House spokesperson told Spaceflight Now, "NASA is vital not only
to spaceflight, but also for critical scientific and technological advancements.
The expertise at NASA is essential to developing innovative new opportunities,
industries and jobs. The President's budget will take steps in that direction."
However, the "fate of the agency's vexed exploration program is still unclear."
The upcoming budget "may provide no direct guidance on the Constellation
program."

Former NASA Official Cautions Over Commercial Human Spaceflight.
In an op-ed for Space
News (1/25, subscription required), Scott Horowitz, former associate
administrator for the exploration systems directorate, wrote about the role he
saw for commercial space companies in manned exploration. "To date, commercial
participants have made limited progress and experienced many challenges.
Contracts have been pulled, failures have occurred and schedules have slipped up
to two years. This has been a stark reminder that rocket development programs
are challenging." Horowitz believes that only after a commercial company
delivers cargo to the International Space Station "will be time to carefully
consider commercial human spaceflight." Horowitz, listing commercial ventures
that have failed, felt that this is "not a time to discard these proven systems"
of Orion and Ares "in favor of immature, high-risk commercial
options."