Irregular pings on life and technology.

 

Colosseum

One of the first things that struck me as I looked around this October while we were on our Roman holiday was the state of structures built around first century AD. They’re all in ruins, and nearly all of’em reduced to indistinguishable rubble. When you look at it from this perspective, the Colosseum staggers the mind.

Hit by numerous earthquakes (notably in 217AD, 223AD, 442AD, 801AD, 1349AD, and in 1703AD), aside from fire, lightning, and later pillaged for construction material (thus dangerously weakening its structural integrity), it is some engineering feat that it still stands remarkably intact. Guts exposed, of course, but it is nothing like the rubble (of the Roman Forum, Circus Maximus, the Palatine Hill, Temples of Elagabalus, Venus and Roma) around it.

Primary cause of partial collapse of the Colosseum’s outer rings, as studies indicate, are attributed to heterogenous ground underneath. Reduced soil stiffness, due to less compact Holocene alluvial deposits it partially sits upon (with the intact parts supported on Pleistocene, volcanic, and sedimentary rocks), led to first differential settlements and by virtue, increased local stresses, which over time, initiated its progressive partial collapse.

What’s insightful about the structure is the way its builders conceived an ingenious new way, using vaults and arches, which not only favored practical construction, but also brought a degree of isolation, and shear wall effect against ground movement. They connected supporting sections of two theaters to create a freestanding building, which served the practical necessity of grouping a large audience around an area of limited proportions.

At a fundamental level, they used a technique of inserting square bronze clamps between building blocks with great amounts of lead used for sealing, as an advanced earthquake-proof system of its time, in which lead was used for absorbing seismic shocks. (The large and indiscreet holes, now observed on the walls of the Colosseum, were apparently made in the Middle Ages for extracting bronze clamps that were fixed vertically to blocks beneath them with lead poured into cups carved in the stone.)

Some interesting factoids I learnt along the way:

  1. The Colosseum’s natural period, as it stands today, is about 0.44s.1

  2. The use of Tufa, the volcanic rock, was recommended by Vitruvius, the world’s first known architect, engineer, and the author of the epic treatise, De Architectura.

  3. The conservative attitude of Vitruvius towards concrete is reflected at the Colosseum, where it is used mainly for the vaults and foundations, but nowhere as a major load-bearing part of the structure. It may be fascinating to assume that Vitruvius understood concrete’s strength rested in its parts. (His specification for concrete is to use close grained hard stone for the mortar because of the importance of strength, while specifying porous stone for stucco, because lack of shrinkage and cracking is important.)

  4. The Colosseum could be quickly flooded for mock water battles, the details of which are very sketchy, but at one point, I read about a reference to Ctesibius’s book of inventions, which Vitruvius possessed. (We know that he also worked on hydraulics.)

  5. Vitruvius set rules for the engineer to follow citing that he should “be a man of letters, an expert draftsman, a mathematician, familiar with scientific thought, a painstaking student of philosophy, acquainted with music, not ignorant of medicine, knowledgeable about the opinions of jurists, and familiar with astronomy and the theory of the heavens.”2

As a structural engineer, I am astonished by its engineering sophistication, and awe-inspired by the minds that planned, designed and constructed it to withstand forces of nature and mankind for 2000 years. An 8th century epigram3, attributed to the Venerable Bede, describes this bloodsport arena best:

While stands the Coliseum, so shall Rome; When falls the Coliseum, so shall Rome; And when Rome falls — the world.

Update: A 50 minute documentary by National Geographic is worth watching.


  1. Cerone, Croci, Viskovic, The structural behaviour of Colosseum over the centuries. 

  2. Alexandar Mckay, Vitruvius, architect and engineer; Mezher, Evolution in the design and construction of stadiums

  3. Roughly translated from the following: “Quandiu stat Colisaeus, stat et Roma; quando cadet Colisaeus, cadet et Roma; quando cadet Roma, cadet et mundus.” 

How do you find needles in a haystack when someone sends you a list containing thousands of documents, and then revising it every few days without markers? Write a script of course. First export the list to a .csv file, and then run this following script:

#!/bin/sh
# 
# Checking documents for instances pertaining
# to offshore TR and LQ.
# 
# Usage:
#
#   $ sh ./filter.sh > filter.txt
# 
grep -ai 'temporary ref' ?*.csv | grep -vi 'onshore'
grep -ai 'living quarter' ?*.csv | grep -vi 'onshore'
grep -ai 'lq' ?*.csv | grep -vi 'onshore'

Enable, simplify, standardize, automate is a corporate motto. I am putting it to work.

Automate

Everybody automates. Many of us for sanity’s sake, if not for saving time. Here’s one from me as an example. Nothing fancy, just a simple collection of oft-repeated commands, put together to save time as I quality-check input, in this case, from analysis results of a moored floating vessel.

#!/bin/sh
# 
# Usage:
#  From the results folder, run the following:
#
#   $ sh ./mchklst.sh > checklist.txt
#  
#  (checklist.txt would be saved in the results
#  folder.)
# 
echo "Mooring output checklist using grep:"
echo "From static output:"
grep -a 'Draft' ?*.STA
grep -a 'Pretension' ?*.STA
grep -a 'Waterdepth' ?*.STA
grep -a 'Z coordinate' ?*.STA
echo ""
echo "From full dynamic output:"
grep -a '.HYD' *.OUT
grep -a 'area above waterline' ?*.OUT
grep -a 'CDN' ?*.OUT
grep -a 'CDT' ?*.OUT
grep -a 'CIN' ?*.OUT
grep -a 'CIT' ?*.OUT
grep -a 'Design draft' ?*.OUT
grep -a 'Displaced moulded volume' ?*.OUT
grep -a 'Elasticity' ?*.OUT
grep -a 'Full dynamic' ?*.OUT
grep -a 'Gamma' ?*.OUT
grep -a 'gust spectrum' ?*.OUT
grep -a 'hydrodynamic data' ?*.OUT
grep -a 'hydrodynamic file' ?*.OUT
grep -a '(Kxx)' *.OUT
grep -a 'Kxx' ?*.OUT
grep -a '(Kyy)' *.OUT
grep -a 'Kyy' ?*.OUT
grep -a 'Kzz' ?*.OUT
grep -a 'Length between perpendiculars' ?*.OUT
grep -a 'Loading condition' ?*.OUT
grep -a 'Mean wave period' ?*.OUT
grep -a 'Projected front' ?*.OUT
grep -a 'Projected side' ?*.OUT
grep -a 'Significant wave' ?*.OUT
grep -a 'Water depth' ?*.OUT
grep -a 'Water depth' *.OUT
grep -a 'wave spectrum' ?*.OUT
grep -a 'Weight (sub' ?*.OUT
grep -a 'Wind direction' ?*.OUT
grep -a 'Wind velocity' ?*.OUT
grep -a '(Xcog)' *.OUT
grep -a 'Xcog' ?*.OUT
grep -a 'X - coordinate' ?*.OUT
grep -a '(Ycog)' *.OUT
grep -a 'Ycog' ?*.OUT
grep -a '(Zcog)' *.OUT
grep -a 'Zcog' ?*.OUT

The fun part of this exercise is in the log it generates—breaking up a ton of output in to sizable stuff I can look at and decide if it’s right.

Similarly, to get specific result set, e.g., mooring line tensions and maximum offsets, I run the following:

grep 'mline' ?*.OUT > linetensions.txt && 
grep '-ref 1 m' ?*.OUT | grep -v 'Z-ref' > offsets.txt

For vertical turret loads:

grep '34F-turret Z' ?*.OUT > z-turretloads.txt && 
grep '32F-turret X' ?*.OUT > x-turretloads.txt && 
grep '33F-turret Y' ?*.OUT > y-turretloads.txt

Filtering text files, which are identified by the system as binary in grep (use -a switch):

grep -a 'Pretension angle' *.STA

Tex

The default MacTEX distribution is massive for a quick download, and to get going. For people on download limits and/or poor internet connections, it is just unreasonable. Thankfully though, there’s a smaller distribution that can do nearly everything; and I found it handy for typesetting1 some personal documents at home.

But upon my first attempt at compiling my type set document (hit Command R in Textmate, I got errors complaining about the following missing packages: fontspec, marginnote, realscripts, sectsty, xltxtra. To install these packages, I opened the Terminal, and punched the following:

sudo tlmgr update --self
sudo tlmgr update --all

The above command updated TEX Live package manager first, and then the existing packages. Thereafter, I installed the missing packages with the following:

sudo tlmgr install fontspec marginnote 
sudo tlmgr install realscripts sectsty xltxtra

My typeset document now compiles.

Compiling a .tex file from command line

If you have MacTex installed, then in all likelihood, xelatex is on your system, which you can use in a Terminal to compile your PDF document from Tex:

xelatex filename.tex 

  1. Be sure to read Dario Taraborelli’s wonderful article on LATEX

Custom cipher

Couple of weeks ago, a friend of mine mentioned the following:

During a recent password audit it was found that a blonde was using the following password:

MickeyMinniePlutoHueyLouieDeweyDonaldGoofySacramento

When asked why she had such a long password, she said she was told that it had to be at least 8 characters long and include at least one capital.

If true, then the thinking behind generating such a password looks good alright. Pick your favorite characters/places/things and salt it with a completely unrelated term, and get yourself a decent password. (Sacramento has a Disney Store, so may not be completely unrelated; but still good nonetheless.)

Many of us struggle to trust or rely on a third party software to generate and store our passwords for us. I’m no exception. The problem with a third-party generated password is that it’s meant to defy logic. And without logic, it’s hard to remember and memorize it. So what do we do? We either write it down, or let one of these apps remember it for us. And by doing so, we open up an opportunity for moments of life to grip us the wrong way.

Instead, what if we could write a password generating phrase down that would constitute some logic to us individually—without compromising our personal security?

It’s quite doable, if you think about it. One way to think of safe passwords is to use a standard cipher—salted to taste. Take ROT13 for example.1 You can write your favorite phrase down—like the blonde, and then encode it with a cipher like ROT13 whenever using it. Doing so, your password gets harder by an order of magnitude. To take it a few notches up, you could write your own non-standard cipher substitution, and use it. And further up that by yet another order of magnitude—by substituting certain numerals and special characters with other numerals and special characters.2

Here’s one I wrote just for the demo.3 Please do read the comments in the code. They’re self-explanatory.

When the script is run, this is what you’d see.

imac:py ckunte$ python mycip.py

Remember to salt your familiar
word/phrase. (Salting is introducing
a combination of random special
characters and numerals in your
familiar phrase that you plan to
encode.)

Text to be encoded: MickeyminnyGoofyDonaldSacramento~
Plain text   :  MickeyminnyGoofyDonaldSacramento~
Ciphered text:  cEsLuINEOOIwPPBIiPOqMtXqsSqNuOUP~
imac:py ckunte$ 

The code4 is basically just five lines when you strip comments, print statements and def statements away. Here’s how they read:

  • Line 1: user is a defined string of modern alphabets. First in caps, then in lower case.

  • Line 2: subs is the cipher (A simple arrangement of characters I choose to substitute for every character in the string assigned user). For every capital A, I substitute it with lower case f; B with g, and so on. The cipher is intentionally a random arrangement of alphabets, and in no particular order — to thwart a cracker if he gets thus far. (In this demo, I simply took the first list, mixed and mashed it randomly to come up with the string called subs.)

  • Line 3: usertxt takes in keyboard input—enter the phrase you want to encode with your custom cipher as defined above.

  • Line 4: ciptrans tells python to define the translate method of user string to subs string—alphabet by alphabet.

  • Line 5: p translates (encodes or substitutes) the text entered at the keyboard with alphabets in subs string.

That’s it; and once you start using it, you’ll notice that while this python script may be a convenience for generating your custom password, it’s really your cipher that’s important, i.e., the user and subs list, that you don’t ever want to lose. Print and tape one to your refrigerator, and the other to your bathroom mirror. :-)


  1. It has a simple character substitution—rotated every 13 characters; hence the name. 

  2. The custom cipher in the script does not substitute numerals or special characters, but you get the idea—to define it, should you want to. 

  3. I wrote the script for python 2.6.1—the one that’s currently on a Mac. For version 3.x, you may have to do the necessary semantic change in the code. (But you’d know that already by looking at the code.) 

  4. I know the code is sloppy—has bad naming convention, but I hope to be excused for being a hobbyist. =) 

Riser clamp script

With some time to spare earlier in the week, I started working on a simple script to automate riser clamp1 design. This was an arbitrary choice; I could well have taken some other structural element up instead for this exercise. But having designed them manually earlier, I had some ready calculations available (from old projects) for running numerical accuracy checks, and for validating the code I was generating. Following is an interesting bit from the exercise. But before I continue, here’s is an illustration of riser clamps for the visually inclined.2

Generating working code in python nearly as fast as I was typing3, I stopped at a point where I had to refer to Roark’s formulas—checking maximum bending stress in flat plates (Table 26, Case 10).

When I do this manually, it’s pretty straight forward: I calculate the aspect ratio (a/b) of the flat plate4, look up the table that matches my value (in the top row), and if found, I pick the β1 up from the corresponding column. If I don’t find a match, then I interpolate (linearly) between the two values that form the immediate lower and upper boundaries of the aspect ratio I computed earlier. For illustration, if my plate dimension is 200 x 100, then, a/b is 2.0, which is the 6th column, and the corresponding β1 would then be 1.226. But if my plate dimension is 220 x 100, then, a/b becomes 2.2. Now, the nearest lower and upper boundaries to this value are 2.0 and 3.0 respectively. Using geometric (or trigonometric) rule for linear interpolation, I’d work out the β1 value corresponding to the a/b ratio of 2.2.

But how to automate this in python? Pretty simple actually. Here’s the example script.

Let me step through the code, and explain how it works:

  • Line 1 imports bisect standard library—for performing some cool referencing. (Without importing the library first, you cannot call the bisect function later in the code to do stuff.)

  • I assigned the top two rows, i.e., the values corresponding to a/b ratios, and the β1 coefficients in the second row from Roark’s Formulas, as lists.

    Lists in python, as you may know, are very handy datatypes that let you perform seemingly complex operations easily with chunks of ordered data.

    First, in the try statement, I attempt to find the index number5, i (which is essentially a column number) that matches the ratio a/b. (For instance, the index number of value 0.75 in the list a_by_b is 2.) Finding the index number is key, because the index (column) number lets me refer to the corresponding value in the second list. Notice how without expressing any relation between the two lists, I am able to correlate between the two simply by finding the index number.

  • If an exact numerical match of the a/b ratio (using the user’s a and b input) is not found in the a_by_b list—in the try statement, then python control jumps to process the except ValueError part.

    Using bisect, I try and find the nearest next numerical value and its corresponding index number. So to take the aforementioned example, if my a/b ratio turns out to be 2.2, then the next numerical value that bisect finds for me is 3.0, and its corresponding i value, which is 6 in this case.

    For tracing index, and the subsequent interpolation, I preferred using bisect from the standard library (instead of using a custom package like numpy that comes with better interpolation tools), so I could keep the number of dependencies (and package installation requirements) to a minimum in order to run this code. Without having to resort to using a sledge hammer to kill a mosquito, I’m happy with it so far.

  • Rest of the code, thereafter, deals with linear interpolattion between two limits (2.0 and 3.0 in this case, and their corresponding β1 values) to get the β1 value (corresponding to 2.2 in this example); and then print those values.

The only shortcut I’ve taken in this crude—doesn’t-catch-all-errors—code yet is, I think, in the exception part. I’ve used that to move the control from simply throwing up ValueError, if a/b is not found in the first loop, to the next loop where the interpolation occurs. (Note: I haven’t yet addressed the IndexError that would occur—when the ratio is either lower than 0.25 or greater than 3.0—in this code.)

Until I work out a more elegant way to do the above, this I think will do for now. Here’s the entire code, pending error sanitation, and a validated documentation, both of which I hope to get done soon.


  1. In general, hanger clamps are designed not only to carry the weight of the riser, but also to withstand marine environmental loads, viz., wind and wave loads experienced by the riser, and for transferring these loads to, say, a supporting fixed jacket structure for example. On the other hand, sliding clamps are designed primarily to withstand and transfer lateral loads, mainly from the marine environment to a supporting structure. Both types of clamps are made up of common structural elements, viz., plates and connection elements (bolts, washers, and nuts). The inner clamp surfaces often have either rubber or a polymer lining for enabling slip resistance. 

  2. For the interested, I’ve uploaded the hanger and sliding clamp 3D models on 3D Warehouse. 

  3. Thanks to the awesomeness of Textmate

  4. Flat plates used in the flange for bolting, and in the annular plate for load bearing. 

  5. Column numbers in python, as you probably know, start from 0.