Sometimes I'm heartened to see a few of the people I read come together for good. Lawrence Lessig and Orin Kerr wrote a great piece for the The Atlantic yesterday that's worth highlighting.
They had a pretty strong disagreement over whether Aaron Swartz violated the CFAA or not, so seeing a former federal prosecutor and an activist for social change come together on this issue made me smile.
Tuesday, April 23, 2013
Monday, April 22, 2013
Self-Scooping
Based on this post over at the Computational Science StackExchange, I had left myself a note here to write a post on how easy it is to make divergence-free fields for use as manufactured solutions for testing incompressible Navier-Stokes solvers, but since the original poster went ahead and asked the question directly, I answered it.
Some background might be in order. The incompressible Navier-Stokes equations are often written:
$$
\begin{align}
\frac{\partial\boldsymbol{u}}{\partial t} + \boldsymbol{u}\cdot\nabla\boldsymbol{u} &= -\frac{1}{\rho}\nabla p + \nu\nabla^2\boldsymbol{u} + \boldsymbol{f} \\
\nabla \cdot \boldsymbol{u} &= 0
\end{align}
$$
These are the classical equations of fluid mechanics for fluids that don't compress very much (like water). This condition is represented by the second equation above and is the force behind making them somewhat tricky to solve (analytically and numerically). The other thing that makes these equations tricky to solve, is the non-linear term in the first equation: \( \boldsymbol{u}\cdot\nabla\boldsymbol{u} \).
When we computer jocks want test the validity of our programs for approximating these equations, we would really like to have some known correct answers to compare our numerical solutions to. Unfortunately, the non-linearity and incompressibility condition conspire to make it hard to come up with a good set of exact solutions to compare to. It is, in fact, an open problem with a substantial prize behind it to determine whether such solutions even exist, or if they do, under what conditions.
The Method of Manufactured Solutions (PDF) is a technique for generating exact solutions to compare your numerical method results to. With MMS, you pick (virtually) any function you like \(\boldsymbol{u}\), substitute it into the governing equations, and solve for the \(\boldsymbol{f}\) that makes that \(\boldsymbol{u}\) a solution. Since \(\boldsymbol{f}\) was a tunable knob in your code that allowed you to solve different kinds of problems, it's a place for making adjustments for testing it, too.
This method works great when every equation you want to solve has a convenient forcing term like \(\boldsymbol{f}\), but as we can see above, not every equation does. Sometimes you get lucky though, and you can create a solution that satisfies the homogenous equation exactly and can be plugged into the other equation to find the right forcing term.
In this case, the choice is to either pick your favorite (sufficiently differentiable) vector field, and take its curl, or pick your two favorite scalar functions and take the cross product of their gradients. That is, either take
$$
\boldsymbol{u} = \nabla \times \boldsymbol{A}
$$
or$$
\boldsymbol{u} = \nabla g \times \nabla h
$$
and crank it all through.
I highly recommend a symbolic manipulation program for this, though. There's lots of room for mistakes.
Some background might be in order. The incompressible Navier-Stokes equations are often written:
$$
\begin{align}
\frac{\partial\boldsymbol{u}}{\partial t} + \boldsymbol{u}\cdot\nabla\boldsymbol{u} &= -\frac{1}{\rho}\nabla p + \nu\nabla^2\boldsymbol{u} + \boldsymbol{f} \\
\nabla \cdot \boldsymbol{u} &= 0
\end{align}
$$
These are the classical equations of fluid mechanics for fluids that don't compress very much (like water). This condition is represented by the second equation above and is the force behind making them somewhat tricky to solve (analytically and numerically). The other thing that makes these equations tricky to solve, is the non-linear term in the first equation: \( \boldsymbol{u}\cdot\nabla\boldsymbol{u} \).
When we computer jocks want test the validity of our programs for approximating these equations, we would really like to have some known correct answers to compare our numerical solutions to. Unfortunately, the non-linearity and incompressibility condition conspire to make it hard to come up with a good set of exact solutions to compare to. It is, in fact, an open problem with a substantial prize behind it to determine whether such solutions even exist, or if they do, under what conditions.
The Method of Manufactured Solutions (PDF) is a technique for generating exact solutions to compare your numerical method results to. With MMS, you pick (virtually) any function you like \(\boldsymbol{u}\), substitute it into the governing equations, and solve for the \(\boldsymbol{f}\) that makes that \(\boldsymbol{u}\) a solution. Since \(\boldsymbol{f}\) was a tunable knob in your code that allowed you to solve different kinds of problems, it's a place for making adjustments for testing it, too.
This method works great when every equation you want to solve has a convenient forcing term like \(\boldsymbol{f}\), but as we can see above, not every equation does. Sometimes you get lucky though, and you can create a solution that satisfies the homogenous equation exactly and can be plugged into the other equation to find the right forcing term.
In this case, the choice is to either pick your favorite (sufficiently differentiable) vector field, and take its curl, or pick your two favorite scalar functions and take the cross product of their gradients. That is, either take
$$
\boldsymbol{u} = \nabla \times \boldsymbol{A}
$$
or$$
\boldsymbol{u} = \nabla g \times \nabla h
$$
and crank it all through.
I highly recommend a symbolic manipulation program for this, though. There's lots of room for mistakes.
Sunday, April 21, 2013
This may be the best talk with the worst ending I've ever seen. After more than thirty-one minutes of inspiring talk on copyright problems (yeah, I know, doesn't really sound inspiring), it ends not with a call to action but a resignation that assumes that kids raised doing remixes will have to change the world. Lame.
If you came of age during the Summer of Love, you'd be in your mid-sixties now. These people have been legislators, judges, and otherwise in power for decades with virtually no changes to our drug laws. It seems to me that the force behind the recent changes in some states aren't the Boomers and Hippies who lived through that decadent time, but the Gen Xers who witnessed the hypocrisy of their failure to legalize their past.
I hope that legalizing remix doesn't follow the same path, with this generation moving from hip, rebellious remixers to stodgy, paranoid primary content producers who are embarrassed by their past and determined to prevent others from building on their present. It would be better for our current crop of legislators to see the change that must happen now rather that waiting for two generations of societal evolution to catch up.
HT: (BoingBoing)
Friday, November 18, 2011
This is what democracy looks like.
(Hat tip: jwz)
Saturday, November 5, 2011
Today's Lessons
Right tool for the right job.
Don't force it.
Steel wool is greater than Scotch Brite.
Saws-alls are awesome.
Wear safety glasses.
Plumbing is hard but not impossible.
Fix it sooner rather than later.
Don't force it.
Steel wool is greater than Scotch Brite.
Saws-alls are awesome.
Wear safety glasses.
Plumbing is hard but not impossible.
Fix it sooner rather than later.
Tuesday, November 1, 2011
Jimmy Bott
The good thing about Bott was that you didn't have to worry about him sneezing in a foxhole and betraying your position like Sanchez did in the Winter of '22. Boy that day sucked! He didn't fall asleep on watch duty either.
Of course, it was weird that only he whirred a bit instead of breathing, but at least it wasn't any louder than any of the rest of us. He'd carry some of your gear for you, too, if you had a blister or just need a break.
On the downside, he weighed at least half a ton, so it was a real son of a bitch to drag him back to cover whenever he got shot. Bott always had point, so that was probably more often than was really fair, but he never seemed to mind.
Friday, October 21, 2011
Test post. If you're reading this on Blogger, then it was posted normally. If you're reading this on LJ, it's been cross-posted from Blogger.
It also contains a link, which hopefully came through.
Love,
Me.
It also contains a link, which hopefully came through.
Love,
Me.
Subscribe to:
Posts (Atom)