.corrosion-calculator-wrapper h2 {
color: #2c3e50;
border-bottom: 2px solid #3498db;
padding-bottom: 10px;
margin-bottom: 20px;
}
.form-group {
margin-bottom: 15px;
}
.form-group label {
display: block;
margin-bottom: 5px;
font-weight: 600;
color: #34495e;
}
.form-group input {
width: 100%;
padding: 10px;
border: 1px solid #bdc3c7;
border-radius: 4px;
font-size: 16px;
box-sizing: border-box; /* Ensures padding doesn't affect width */
}
.form-group .unit-hint {
font-size: 0.85em;
color: #7f8c8d;
margin-top: 4px;
}
.calc-btn {
background-color: #e74c3c;
color: white;
border: none;
padding: 12px 20px;
font-size: 16px;
border-radius: 4px;
cursor: pointer;
width: 100%;
transition: background 0.3s;
font-weight: bold;
}
.calc-btn:hover {
background-color: #c0392b;
}
.result-box {
margin-top: 25px;
background-color: #fff;
padding: 20px;
border-radius: 4px;
border-left: 5px solid #e74c3c;
display: none;
box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.result-item {
margin-bottom: 10px;
font-size: 18px;
color: #2c3e50;
}
.result-value {
font-weight: bold;
color: #e74c3c;
}
.common-densities-table {
width: 100%;
border-collapse: collapse;
margin-top: 20px;
font-size: 0.9em;
}
.common-densities-table th, .common-densities-table td {
border: 1px solid #ddd;
padding: 8px;
text-align: left;
}
.common-densities-table th {
background-color: #f2f2f2;
}
.content-section {
margin-top: 40px;
line-height: 1.6;
color: #444;
}
.content-section h3 {
color: #2c3e50;
margin-top: 25px;
}
.formula-box {
background: #eee;
padding: 15px;
border-radius: 5px;
font-family: monospace;
margin: 15px 0;
overflow-x: auto;
}
Corrosion Rate Calculator
function calculateCorrosion() {
// Retrieve input values
var initWeight = parseFloat(document.getElementById('initialWeight').value);
var finalWeight = parseFloat(document.getElementById('finalWeight').value);
var area = parseFloat(document.getElementById('surfaceArea').value);
var time = parseFloat(document.getElementById('exposureTime').value);
var density = parseFloat(document.getElementById('density').value);
var resultBox = document.getElementById('resultOutput');
// Reset previous errors or results
resultBox.style.display = 'none';
// Validation: Check for valid numbers
if (isNaN(initWeight) || isNaN(finalWeight) || isNaN(area) || isNaN(time) || isNaN(density)) {
alert("Please fill in all fields with valid numbers.");
return;
}
// Validation: Check for positive values where required
if (initWeight <= 0 || finalWeight < 0 || area <= 0 || time <= 0 || density <= 0) {
alert("Please enter positive values for weights, area, time, and density.");
return;
}
// Validation: Check if weight loss is logical
var weightLoss = initWeight – finalWeight;
if (weightLoss < 0) {
alert("Error: Final weight cannot be greater than initial weight for a weight loss calculation.");
return;
}
// Constants based on input units: g, cm^2, hours, g/cm^3
// To get mm/year: K = 8.76 x 10^4
var K_mm = 8.76 * Math.pow(10, 4);
// To get mpy (mils per year): K = 3.45 x 10^6
var K_mpy = 3.45 * Math.pow(10, 6);
// Calculate Corrosion Rates
// Denominator
var denominator = area * time * density;
// Prevent division by zero just in case
if (denominator === 0) {
alert("Invalid inputs resulting in division by zero.");
return;
}
var cr_mm = (K_mm * weightLoss) / denominator;
var cr_mpy = (K_mpy * weightLoss) / denominator;
// Display Results
document.getElementById('resWeightLoss').innerText = weightLoss.toFixed(4);
document.getElementById('resMpy').innerText = cr_mpy.toFixed(2);
document.getElementById('resMmpy').innerText = cr_mm.toFixed(4);
resultBox.style.display = 'block';
// Scroll to result
resultBox.scrollIntoView({behavior: "smooth"});
}
Corrosion Rate Calculator
Weight Loss Method
Unit: grams (g)
Unit: grams (g) – After cleaning
Unit: square centimeters (cm²)
Unit: hours (h)
Unit: grams per cubic centimeter (g/cm³)
Calculation Results
Total Weight Loss: g
Corrosion Rate (mpy): (mils per year)
Corrosion Rate (mm/y): (millimeters per year)
About the Weight Loss Method
The weight loss method is the most widely used technique for determining the corrosion rate of metals. It involves exposing a clean, weighed specimen to a corrosive environment for a specific period, cleaning it to remove corrosion products, and weighing it again to determine the mass lost.
Corrosion Rate Formula
This calculator uses the standard ASTM G1 formula for calculating corrosion rate:
CR = (K × W) / (A × T × D)
Where:
- CR = Corrosion Rate
- K = A constant used to define the units of the corrosion rate
- W = Mass loss in grams (Initial Weight – Final Weight)
- A = Surface area in cm²
- T = Time of exposure in hours
- D = Density in g/cm³
Constants (K) Used
To convert the inputs into standard industry metrics, specific constants are applied:
- For mils per year (mpy): K = 3.45 × 106
- For millimeters per year (mm/y): K = 8.76 × 104
Common Material Densities
Use the table below to find the density (g/cm³) for common industrial metals if unknown:
| Material | Density (g/cm³) |
|---|---|
| Carbon Steel | 7.87 |
| Stainless Steel (304) | 7.90 |
| Stainless Steel (316) | 8.00 |
| Aluminum (1100) | 2.71 |
| Copper | 8.96 |
| Brass (Yellow) | 8.47 |
| Titanium | 4.54 |
| Zinc | 7.13 |
Interpreting the Results
The significance of the corrosion rate depends on the application. Generally, in industrial applications:
- < 1 mpy: Outstanding corrosion resistance.
- 1 – 5 mpy: Good corrosion resistance; acceptable for most equipment.
- 5 – 20 mpy: Fair; regular maintenance may be required.
- > 20 mpy: Poor; material may not be suitable for the environment without protection.