Mechanical Engineering AWKscriptsThe intent here is not simply to hand out free awkscripts, or to eventually accumulate all the scripts an engineer could ever want (dream on!). The intent is to convince engineers to start writing their own scripts, and that it is easy with AWK. Again, AWK is embedded in all Linux / Unix operating systems, and it runs from the command line (in a terminal window). If you have been using windows for so long that you forgot what this means, read the command line page. Is is possible to run awkscripts using a nice graphical user interface (see Tclforawk), but that is unecessary. Below, you will find a growing set of awkscripts to do various engineering calcs. The first group that I am posting deals with heat transfer, as that is my recent expertise. After that is complete, I'll start posting vibration, dynamics, structures type scripts. This page will link to the files associated with each awkscript. In each case there is an input file, a script file, a sample output file. After saving to disk, these should run right out of the box (famous promises ! ) by typing, at the command line:
The input file may be edited, but note that the script file assigns values to variables, based on the first field ($1) of each line in the input. It sets the variable numeric values equal to either the second ($2) or third ($3) fields on the line (check the script). If you change the first field, you must edit the awkscript accordingly. Be aware that these are links to raw text files (not HTML formatted) and will appear different in your web browser window than they do in your text editor window, after being saved to disk. They look best when a monospace font is used in your web browser or text editor; proportional fonts will make the columns slightly crooked. Also, some of these awkscripts include a bunch of statements for making barchart type plots in the output. Recognize that this stuff is bells and whistles that can be deleted as desired, to make the script smaller and more readable. |
Heat Transfer Through a Multi-Layered Wall or Flat PlateThis script calculates the heat transfer through a flat wall or plate made up of several material layers and having convection heat transfer on both sides of the wall or plate. Here is a short discussion of the laminated plate topic. The AWK files are: input file, awkscript, output file. The AWK files using US units are: input file, awkscript, output file. Heat Transfer From a House (Added Aug.2008)This script calculates the overall average heat transfer out of a house through a winter. It also calculates and compares oil heat to a geothermal heat pump. Here is a short discussion of the home heating topic. The AWK files are: input file, awkscript, output file. External Flat Plate Flow (Laminar-to-Turbulent HTC's)This script calculates the convection heat transfer coefficient on the surface of a flat plate with fluid flowing over it. The boundary layer may transition from laminar to turbulent, as established by the critical Reynold's number (a user input value). Here is a short discussion the external flow / flat plate topic. The AWK files are: input file, awkscript, output file. The AWK files using US units are: input file, awkscript, output file. Heat Transfer Through The Wall a Multi-Layered Pipe, Tube or DuctThis script calculates the heat transfer through a pipe, tube or duct made up of several material layers and having convection heat transfer on both sides of the wall. Here is a short discussion the laminated pipe topic. The AWK files are: input file, awkscript, output file. The AWK files using US units are: input file, awkscript, output file. Internal Forced Convection Coefficients in a Pipe, Tube or DuctThis script calculates the internal heat transfer coefficients for flow through an intenal passage (pipe, tube, duct). It includes an "entrance effect" where the coefficients are larger at the inlet, as the boundary layer builds up. It also includes the effects of fluid being heated or cooled, and uses a laminar boundary layer if the Reynold's number is below 2300. Here is a short discussion the internal pipe flow topic. The AWK files are: input file, awkscript, output file. The AWK files using US units are: input file, awkscript, output file. External Forced Convection Coefficients on a Pipe, Tube or DuctThis script calculates the average heat transfer coefficient on the external wall of a pipe, with forced convection (fluid flowing across the pipe at some prescribed velocity). Here is a short discussion the external pipe flow topic. The AWK files are: input file, awkscript, output file. Impingement Jet Heat Transfer CoefficientsA short discussion of the topic is here: impingement.html . The AWK files are: input file , awkscript , output file . 1DOF VibrationsThis script calculates the forced, damped response of a 1 degree of freedom mass & spring system. Input file, script file, sample output file This is the classic textbook 1DOF response to an applied force of fixed magnitude and varying frequency. A crude bar chart is plotted for a quick visual check. In the future, I'll upgrade this to a TCL canvas widget graph, but this will also plot on the command line output to the screen (which is a benefit of the crude bar chart method). Beam Vibration FrequenciesThis script calculates the first few natural frequencies of beams with common end conditions. It allows added distributed weight and a G-level for simulating static shock, and calculates the resulting peak deflection and peak stress. Input file, script file, sample output file The equations for beam natural frequencies are straight from the appendix of DenHartog's book. Rotor Shaft VibrationsThis script calculates the first natural frequency of a uniform rotor shaft on resilient bearings. A distributed weight may be added. It also calculates the damped, forced response to a specified (oz-in) unbalance at the midspan of the shaft. Input file, script file, sample output file The unbalance force is F = m*r*(RPM * pi / 30)2, which increases with speed. The m*r term is converted from the commonly specified oz-in to the correct units for the calculation. The response is calculated as a function of frequency ratio, using the classic textbook equation for a 1 degree of freedom system. Critical frequencies are explicitly calculated as well. Basic Heat Exchanger SizingThis script is a simple calculation of the heat transfer requirements for a heat exchanger. This is taken as U * A, where U = the overall heat transfer coefficient of the design, and A = the total heat transfer area between the two fluids. The user can tweak any or all of the input variables until Qhot = Qcool. At that condition, the total heat lost by one fluid equals the total heat gained by the other fluid. This equality must be achieved (by user input variables) or the resulting answers will be incorrect. The script was written this way to allow the user infinite latitude for tweaking whatever variables desired. But the requirement that Qhot = Qcool must be met. The AWK files are: input file, awkscript, output file. The AWK files using US units are: input file, awkscript, output file. |