Skip to main content

9 posts tagged with "Design"

View All Tags
Case Generator Montecarlo

Case Generator Montecarlo

· 2 min read

Over the years I have often perturbed a design or model or strategy for sensitivity analysis and optimization. The typical situation is that I have a model for something like an optical system, a heat exchanger, or a nuclear core, and the model has a bunch of knobs and inputs, and bunch of outputs including value functions to optimize or observe. I then have to run various extreme cases or choose a good set of inputs to optimize one of the outputs. It's always the same thing and it made sense to standardize it so I don't have to keep copy pasting code.

1 Example of 2d sensitivity.
1 Example of 2d sensitivity.
1 Example of 2d sensitivity.

casegenmc is python package to organize models, generate and run cases, estimate uncertainty, and optimize. There are ways to study the statistical metrics of the studies, e.g. value functions the incorporate the uncertainty.It also has some decent plotting capability. The source is here and it is pip installable and bit a buggy: https://github.com/lvenneri/casegenmc

2 Example uncertainty estimate.
2 Example uncertainty estimate.
2 Example uncertainty estimate.

It includes some convenience function for using optimization algorithms available from other packages. I have been using NEORL recently, a package my advisor and my friend have contributed to, which packages several evolutionary algorithms in one place.

Cookie Dunking Phenomena and Design (Part 1)

Cookie Dunking Phenomena and Design (Part 1)

· 11 min read

Previously, Len Fisher addressed the issue of biscuits lost at tea 1. As a cookie soaks, the sugar and fats dissolve, the starch grains bloat, and the biscuit falls apart pretty quickly. Fisher was trying to increase the dunk time before structural failure so the timing would be less stressful and finicky. The strategy he proposed was:

  1. Insert one end of the biscuit into the liquid at an angle which can lead to a dryer structural top side (his explanation) for longer; and
  2. Add a chocolate sheet that keeps it structurally sound.

He won an (Ig) Nobel Prize for this. But the "horizontal" orientation offers such a small advantage that he has to use a supersize cookie for demos and the results look insubstantial in practice. The angling has not really done it for me. The wet front climbs the cookie without leaving much of a dry side.

In any case, I have a different problem because I like to soak cookies in whole milk which, as I’ll explain later, is a painfully slow process with mixed results. For example, the cookie can equilibrate with a dry portion inside depending on how it is dipped. I just want to wolf down fully soaked cookies as fast as possible but without losing them. I'm also interested in a cookie I can just toss in and wait to see it soak without sinking. The general strategies are listed below, and they will make sense using a simple equation and a few other observations.

  1. Minimize soak path length.
  2. Orient horizontally to reduce the gravitational head or submerge partially so that gravity pushes liquid into the cookie from above.
  3. Maximize the wetted surface for a larger flow area with geometries of high surface area to volume ratio.
  4. Maintain a snorkel to allow gas to escape. Without a snorkel, the gas may become trapped.
  5. Use chocolate for water impervious structure but also to create dynamic gas traps.
  6. Increase pore size and surface tension.
  7. Reduce liquid contact angle (highly wetting) or control for desired function.
  8. Keep in mind the shortest path length, and use shapes that have a single path length - torus, sphere - so things don't snap off.
  9. Use surface tension to keep soaked objects afloat.

What is soaking?

Soaking a cookie involves a liquid displacing the air in the cookie’s porous interior. Why is this even possible? Hydrostatic pressure and capillary rise of the fluid can drive the fluid to displace the air. Hydrostatic pressure is just the phenomenon that liquid will fill the cavities up to the liquid surface, like an inverted cup in water. Capillary action is what pulls liquids up thin tubes.

We can think of the cookie and its pores as a network of capillaries that feed up and sideways, and we just fit the observed data to find equivalent radii and contact angles that work. One picture is a capillary going up the cookie. We might also consider the capillaries in the short direction.

1 Network of capillaries to approx a cookie.
1 Network of capillaries to approx a cookie.
1 Network of capillaries to approx a cookie.

To account for the many pores that interface with the liquid surface, we can simply multiply by the wetted surface area. Cookie porosity is in the range of 0.5 to 0.8 2. Pore size ranges from 5 to 300 microns, and a representative pore size would be about 150 microns 3.

Capillary rise, also called imbibition, pulls the fluid to rise above the liquid surface level until this capillary pressure balances with the pressure of the liquid column. Balancing the two pressures gives the following equilibrium soak distance XX along the cookie where HH is the height, α\alpha is the angle of the column with respect to the surface, θ\theta is the liquid contact angle of the fluid, σ\sigma is the surface tension, rr is pore radius, and ρ\rho is the density. This is also known as Jurin’s Law.

X=Hsinα=PcapPgrav=2σcos(θ)rρgsin(α)X = \frac{H}{\sin{\alpha}} = \frac{P_{\text{cap}}}{P_{\text{grav}}} = \frac{\frac{2\sigma\, \cos\left(\theta\right) }{r}}{\rho g\, \sin\left(\alpha\right)}
2 Slanted capillary tube.
2 Slanted capillary tube.
2 Slanted capillary tube.

As it happens, this equilibrium soak length is often very large, much larger than a cookie. So we’re actually interested in the velocity or soak rate to achieve a certain xx soak length rather than the max equilibrium soak length XX. To do that, we use the Hagen–Poiseuille equation which describes laminar flow for incompressible Newtonian fluids.

Starting from the Hagen–Poiseuille equation we have

dxdt=r28μxΔp\frac{dx}{dt} = \frac{r^2}{8\mu x} \Delta p

The pressure term is the capillary pressure minus the column pressure. For areas under the liquid surface, there is an additional but negligible pressure of the liquid height which is ignored here.

Δp=ΔpC+Δph=2σcos(θs)rρgxsin(α)\Delta p = \Delta p_C + \Delta p_{h} = \frac{2\sigma\, \cos\left(\theta_s\right)}{r} - \rho g x \sin\left( \alpha\right)

Substituting into the above velocity equation

dxdt=r28μ[2σcos(θ)rxρgsin(α)]\frac{dx}{dt} = \frac{r^2}{8\mu} \left[ \frac{2\sigma\, \cos\left(\theta\right)}{r x} - \rho g \sin\left(\alpha\right) \right]

Already this shows how reducing the angle of the cookie can increase the velocity along the cookie length. I think Fisher's idea was that this is a small effect and one can increase the soak along the cookie to be closer or faster than the flow up the thin side of the cookie, which could leave a dry backbone on top for longer.

Another observation is that gravity can help increase the flow velocity. Imagine we can somehow dip the cookie into an upside down cup. The gravitational pressure term is now in the same direction as the capillary term. This occurs for the top side of a cookie dipped slanted into a liquid. The soak front moves down faster than it moves upward, and the dry internal structure will be asymmetric.

Now solving for t by integration,

t=8μr2ρgsinαX[ln(1xX)xX]t = \frac{8\mu}{ r^2 \rho g \sin{\alpha}} X \left[ -\ln\left(1 - \frac{x}{X}\right) - \frac{x}{X} \right]

For small xX\frac{x}{X} (the fraction of maximum distance), ln(1y)y12y213y3ln(1-y) \approx -y-\frac{1}{2} y^2-\frac{1}{3} y^3-\cdots

t4μr2ρgsinαX(xX)2t \approx \frac{4\mu}{ r^2 \rho g \sin{\alpha}} X \left( \frac{x}{X}\right)^2

By substituting XX we recover the Washburn equation relating soak length to the time, pressure difference, surface tension, density, and viscosity:

x=σrtcos(θ)2μx = \sqrt{\frac{\sigma r t \cos{\left(\theta\right)} } {2\mu} }

Or rearranging to solve for soak time

t=2μx2σrcos(θ)t = \frac{2\mu x^2}{\sigma r \cos{\left(\theta\right)}}

We can also incorporate a rough dependence on wetted area by noting that we are interested in the time to soak the volume and that

dxdtA=dVdt\frac{dx}{dt} A = \frac{dV}{dt}

With this we now have

t=2μx2Aσrcos(θ)t = \frac{2\mu x^2}{A \sigma r \cos{\left(\theta\right)}}

This simple equation has quite a bit of explanatory power. For the shortest soak time, we want large pores, low viscosity, short path lengths, low liquid contact angle (hydrophilic) and high surface tension. Note that the angle of the cookie is only contained in higher order terms, but sin(α)sin(\alpha) would be in the numerator so that a slanted dip (smaller angle α\alpha) with the same wetted surface would reduce the soak time.

Warm tea vs cold milk

One observation we should be able to explain is that biscuits soak faster in tea compared to milk and the soak rate appears to slow down the more cookies have been dunked. This can be explained by viscosity. Water has a viscosity two times lower than milk, and its viscosity drops with increasing temperature (sidenote: cream has a viscosity about 15x greater than whole milk). So a hot mug of tea is going to soak a cookie much faster than a cold glass of milk. Similarly, the more cookies are dunked in a glass of milk, the more sugar is dissolved into the milk, which increases the viscosity and slows down the soaking.

Water’s higher surface tension also plays a role as the capillary pressure increases linearly with surface tension. Water’s surface tension against air is 72 dyn/cm (1×1031 \times 10^{-3}) N·m) at 25°C and 58.9 dyn/cm at 100°C. Whole milk has a surface tension of 45.5 dyn/cm at 25°C and 35.5 dyn/cm at 100°C. This is another 1.5–2× factor 4.

I also suspect there's some differences in the liquid contact angle, and the chemistry and reaction rate of hot water dissolving sugars in the cookie, but not sure.

3 Milk surface tension.
3 Milk surface tension.
3 Milk surface tension.

The viscosity and surface tension of milk have interesting effects on splashing and droplet formation.

4 Milk drop tests Microscopy-UK.
4 Milk drop tests Microscopy-UK.
4 Milk drop tests Microscopy-UK.

Fully submerged cookies

I’ve also observed some dramatic variations in soak rate depending on the orientation and position of the cookie in the liquid. Here we are dealing with some subtleties about the cross-sectional flow area, imbibing length, pressure differences, and gas outlets.

One curious configuration is the fully submerged case. I'm aiming to maximize the flow area but the result is a cookie with that equilibrates with a dry internal section. To be clear - the cookie is fully submerged and is removed with a dry portion inside. What's happening? As fluid starts to permeate, where does the air that originally occupies the pores go? Some might manage to escape at the beginning, but it may be somewhat trapped because of the liquid boundary which seals the air inside unless its pressure is greater than the bubble point. I say somewhat because there may be a differential pressure that breaks the seal on the top. The internal pressure of the trapped air goes up, which opposes the capillary action or pressure difference that was driving the flow. This pressure must exceed the bubble point of the biscuit so that air can get through the pores on the cookie’s surface currently blocked by the liquid.

ΔPBubble=2σr\Delta P_{\text{Bubble}} = \frac{2\sigma}{r}

The internal pressure also resists the capillary flow. The equilibrium between the two is reached when the fluid pressure equals the trapped gas pressure. The gas pressure starts to rise from PAP_A, the original atmospheric pressure, and it rises with the inverse volume. The fluid pressure driving the flow into the cookie is constant and is the sum of atmospheric, hydrostatic, and capillary pressure. This means the equilibrium is reached when the fluid occupies a fraction α\alpha of the total pore volume VpV_p.

α=VLVp,β=VgVp,1=α+β\alpha = \frac{V_L}{V_p}, \quad \beta = \frac{V_g}{V_p}, \quad 1 = \alpha + \beta Pgas=PAβ=2σR+ρgh+PAP_{\text{gas}} = \frac{P_A}{\beta} = \frac{2\sigma}{R} + \rho g h + P_A α=1PA2σR+ρgh+PA1PA2σR+PA\alpha = 1 - \frac{P_A}{\dfrac{2\sigma}{R} + \rho g h + P_A} \approx 1 - \frac{P_A}{\dfrac{2\sigma}{R} + P_A}

I suppose the depths are often quite low, and the imbibing is not uniform, so there could be ways for a dominant gas path to establish itself and prevent a liquid seal. This could be aided by a pointy structure that concentrates the air flow in a small path with quickly rising high flow that does not get clogged by water. This could explain why this effect is not present in all cookies, just the most round and thick.

Something else to consider is that the gluten grains expand as they absorb water, which will lead to a shrinking pore size and kind of continuous exfoliation of the outer layer of imbibed cookie. This would probably be a kind of staggered process that would allow for instabilities and gas paths to form intermittently, relieving the pressure of the internal gas. If the pores were structurally sound, perhaps the capillary seal would work.

We can still maximize the surface area and minimize capillary path length by laying the cookie flat on the surface. Now this also has an unexpected result. The cookie soaks but never sinks! This is true when the top side is left dry at the start. If it is just slightly wetted it will soak and sink. But if it is dry, it remains afloat but fully soaked! It is however unstably afloat, because when you just touch, it sink right away. I believe this has to do with surface tension which helps create an upward force and an additional buoyancy force if the there is a below liquid level void created by the surface tension 5.

5 Generalized archimedes.
5 Generalized archimedes.
5 Generalized archimedes.

Next, I will introduce some new cookie geometries and properties that leverage these observations. There will be some new designs taking advantage of dynamic effects.

Footnotes

  1. https://www.lenfisherscience.com/92-the-art-and-science-of-dunking/, 2015

  2. Sman, Thermodynamic description of the chemical leavening in biscuits, 2021.

  3. Characterization Of The Pore Structure Of Starch Based Food Materials, 1992.

  4. Watson, Effect Of Variations In Fat And Temperature On The Surface Tension Of Various Milks, 1958.

  5. Naylor, Archimedes’ principle with surface tension effects in undergraduate fluid mechanics, 2022.

Artificial Atmospheric Absorption for Spectrum Generation

Artificial Atmospheric Absorption for Spectrum Generation

· 2 min read

The solar spectrum shows up at Earth looking pretty close to a black body of 5777 K. As it goes through the Earth's atmosphere, there are various absorption and scattering interactions that change the spectrum to produce some distinct lines and features. I was curious how I might recreate the solar spectrum as measured on the surface of the Earth if I had a beam of light from a warm blackbody of the same temperature as the Sun.

Water filters can do the trick for many of the features above 500 nm, but I found out that it takes many meters of water vapor to get the spectral features, and that liquid water has quite a different absorption coefficient than water vapor. One trick could be to pressurize the water and increase the temperature to increase the density of the vapor. In this way, the length required is manageable. Potentially only a rather thin medium is needed if we tune the pressure and temperature and fluid quality within engineering constraints for pressurized transparent vessels. We might also be able to add some other constituents to get other features in the spectrum.

Below, the top plot shows a blackbody and the solar spectrum as measured in space and on the surface of the Earth. The third plot shows the absorption coefficients for the different filters. The second plot applies those filters to a blackbody for a particular filter length.

1 Black body absorption through water filters of different thickness L.
1 Black body absorption through water filters of different thickness L.
1 Black body absorption through water filters of different thickness L.

For those curious, spectral absorption data like this can be found here:

Economies of Quality - Levelized Cost on Long Time Horizons

Economies of Quality - Levelized Cost on Long Time Horizons

· 12 min read

Modern economies tend to organize themselves to produce larger volumes of lower-quality goods. This results in lower initial capital expenditures (CAPEX) unlocking greater sales for the seller but at the expense of higher operational expenditures (OPEX) for the buyer, including replacement costs, resulting in higher levelized cost (LC) of goods. This applies to everyday consumer goods like coffee machines, furniture, and homes; as well as industrial systems like power-generating equipment and infrastructure. We provide a simple model to estimate the LC by introducing the idea of economies of quality which defines OPEX as a function of CAPEX with a scaling exponent (α\alpha). When the scaling exponent exceeds one and for many financial conditions, we find that non-zero CAPEX can minimize long-term cost. This finding is consistent with the everyday notion that spending on higher quality is worth it. Overall we suggest that prioritizing higher CAPEX is economically advantageous under many conditions challenging the dominant CAPEX-minimization strategies rooted in seller-side profit-seeking and buyer-side short-termism.

Design for Cost Methods

Design for Cost Methods

· 5 min read

SpaceX’s Falcon 9 is like a Toyota Corolla – an order of magnitude cheaper than competitor’s “high performance” rocket systems, the Ferraris, but achieving the same basic transport requirements with greater reliability and safety. Before Falcon, space launch was a Ferrari-like industry, with handmade, highly specialized, extremely expensive vehicles targeting government customers and fully complicit in the inefficiencies of government contracting. Similarly, the nuclear industry produces and still designs Ferrari-like fission reactors, with high performance metrics in terms of power density and unit power, at a megaproject scale, but with high system and operational complexity, extreme development cost, numerous part counts, and very low production and deployment rates that still require human-machine interface to meet societal safety objectives. The demand for nuclear Ferraris in the U.S., particularly within non-traditional energy utilities is very low, as few competent utilities want unique reactors with such high capital costs, running at such high power that low probability accidents can have offsite consequences. Where is the nuclear Corolla?

RX Power
Figure 1 Design space under random sampling showing effect of RX Power on the Levelized Cost of Electricity.
SiC Mug

SiC Mug

· 3 min read

A design for a SiC mug utilizing advanced additive manufacturing techniques.

Motivation

Create the first SiC mug – a useful and rare artifact using additive process now available from 3dcarbide.com. There is one issue in that SiC is a bit more thermally conductive than most ceramics, so it may not be the best choice for a hot beverage.

Reduced Distortion Eye-Ware

Reduced Distortion Eye-Ware

· 5 min read

Reduced Distortion Protective Eye-Ware

This is part of the design thesis aiming for

  1. Physically derived functionality
  2. Conformity to human needs
  3. Reduced constraints from manufacturing and cost
Nuke Graphics

Nuke Graphics

· One min read

I made these for Ultra Safe Nuclear’s website. It’s a relatively simple process of exploding the parts in the right order with the right natural motion and coordination so that things just snap into place.