.corrosion-calculator-wrapper {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
max-width: 800px;
margin: 0 auto;
background: #fff;
color: #333;
line-height: 1.6;
}
.calc-container {
background-color: #f8f9fa;
border: 1px solid #e9ecef;
border-radius: 8px;
padding: 30px;
margin-bottom: 40px;
box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}
.calc-title {
text-align: center;
color: #2c3e50;
margin-bottom: 25px;
font-size: 24px;
font-weight: 700;
}
.form-grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 20px;
}
@media (max-width: 600px) {
.form-grid {
grid-template-columns: 1fr;
}
}
.input-group {
margin-bottom: 15px;
}
.input-group label {
display: block;
margin-bottom: 8px;
font-weight: 600;
font-size: 14px;
color: #495057;
}
.input-group input, .input-group select {
width: 100%;
padding: 12px;
border: 1px solid #ced4da;
border-radius: 4px;
font-size: 16px;
transition: border-color 0.2s;
box-sizing: border-box;
}
.input-group input:focus {
border-color: #007bff;
outline: none;
}
.calc-btn {
width: 100%;
padding: 15px;
background-color: #007bff;
color: white;
border: none;
border-radius: 4px;
font-size: 18px;
font-weight: 600;
cursor: pointer;
margin-top: 10px;
transition: background-color 0.2s;
}
.calc-btn:hover {
background-color: #0056b3;
}
.results-box {
margin-top: 25px;
padding: 20px;
background-color: #e8f4fd;
border-radius: 6px;
border-left: 5px solid #007bff;
display: none;
}
.result-row {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 10px;
padding-bottom: 10px;
border-bottom: 1px solid #d1e7dd;
}
.result-row:last-child {
border-bottom: none;
margin-bottom: 0;
padding-bottom: 0;
}
.result-label {
font-weight: 600;
color: #495057;
}
.result-value {
font-weight: 700;
color: #007bff;
font-size: 18px;
}
.error-msg {
color: #dc3545;
text-align: center;
margin-top: 10px;
font-weight: 600;
display: none;
}
.article-content h2 {
color: #2c3e50;
margin-top: 35px;
border-bottom: 2px solid #eee;
padding-bottom: 10px;
}
.article-content h3 {
color: #495057;
margin-top: 25px;
}
.article-content p, .article-content li {
font-size: 16px;
color: #444;
}
.article-content ul {
padding-left: 20px;
}
.formula-box {
background: #f1f3f5;
padding: 15px;
border-radius: 4px;
font-family: monospace;
text-align: center;
margin: 20px 0;
font-size: 18px;
}
.density-table {
width: 100%;
border-collapse: collapse;
margin: 20px 0;
}
.density-table th, .density-table td {
border: 1px solid #dee2e6;
padding: 10px;
text-align: left;
}
.density-table th {
background-color: #f8f9fa;
}
function calculateCorrosionRate() {
// Get DOM elements
var initialWeightInput = document.getElementById('initialWeight');
var finalWeightInput = document.getElementById('finalWeight');
var areaInput = document.getElementById('surfaceArea');
var timeInput = document.getElementById('exposureTime');
var densityInput = document.getElementById('density');
var kSelect = document.getElementById('kFactor');
var resultBox = document.getElementById('resultsBox');
var errorMsg = document.getElementById('errorMessage');
var resWeightLoss = document.getElementById('resWeightLoss');
var resRate = document.getElementById('resRate');
var resMetric = document.getElementById('resMetric');
// Parse inputs
var iW = parseFloat(initialWeightInput.value);
var fW = parseFloat(finalWeightInput.value);
var area = parseFloat(areaInput.value);
var time = parseFloat(timeInput.value);
var density = parseFloat(densityInput.value);
var kFactor = parseFloat(kSelect.value);
// Reset display
errorMsg.style.display = 'none';
resultBox.style.display = 'none';
// Validation
if (isNaN(iW) || isNaN(fW) || isNaN(area) || isNaN(time) || isNaN(density)) {
errorMsg.innerText = "Please fill in all fields with valid numbers.";
errorMsg.style.display = 'block';
return;
}
if (area <= 0 || time <= 0 || density iW) {
errorMsg.innerText = "Final Weight cannot be greater than Initial Weight (Weight Gain detected).";
errorMsg.style.display = 'block';
return;
}
// Calculation Logic (ASTM G1 Formula)
// Rate = (K * W) / (A * T * D)
// W = Weight Loss in grams
var weightLoss = iW – fW;
var corrosionRate = (kFactor * weightLoss) / (area * time * density);
// Calculate Metric conversion for context
// If output is mpy, calculate mm/y. If output is mm/y, calculate mpy.
var secondaryRate = 0;
var primaryUnit = "";
var secondaryUnit = "";
if (kFactor > 1000000) { // Using mpy constant
primaryUnit = "mpy";
// Convert mpy to mm/y: 1 mpy = 0.0254 mm/y
secondaryRate = corrosionRate * 0.0254;
secondaryUnit = "mm/y";
} else { // Using mm/y constant
primaryUnit = "mm/y";
// Convert mm/y to mpy: 1 mm/y = 39.37 mpy
secondaryRate = corrosionRate * 39.3701;
secondaryUnit = "mpy";
}
// Display Results
resWeightLoss.innerText = weightLoss.toFixed(4) + " g";
resRate.innerText = corrosionRate.toFixed(4) + " " + primaryUnit;
resMetric.innerText = secondaryRate.toFixed(4) + " " + secondaryUnit;
resultBox.style.display = 'block';
}
Calculating Corrosion Rate: A Comprehensive Guide
Corrosion rate calculation is a fundamental aspect of material science and engineering integrity management. It quantifies the speed at which a specific material deteriorates in a given environment. This calculator utilizes the standard weight-loss method outlined in ASTM G1, replacing the need for manual corrosion rate calculation PDF references.
The Standard Formula (ASTM G1)
The industry-standard formula for calculating corrosion rate based on mass loss is:
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³
Understanding the Inputs
1. Weight Loss (W)
This is the difference between the initial weight of the specimen before exposure and the final weight after cleaning. In our calculator, you input both weights, and the logic automatically derives the loss. It is crucial that the final weight is measured after all corrosion products have been removed according to standard cleaning procedures (e.g., acid cleaning for steel).
2. Surface Area (A)
The total surface area exposed to the corrosive environment. For a flat coupon, this includes the front, back, and sides. Accurate area measurement is vital; a 10% error in area results in a 10% error in the calculated rate.
3. Material Density (D)
The density of the metal allows the formula to convert mass loss into a penetration depth (thickness loss). Different alloys have different densities.
Common Material Densities
| Material |
Density (g/cm³) |
| Carbon Steel (1020) |
7.87 |
| Stainless Steel (304/316) |
8.00 |
| Aluminum (1100) |
2.71 |
| Copper |
8.94 |
| Brass (Yellow) |
8.53 |
| Titanium |
4.51 |
Interpreting the Units (K Constant)
The "K" factor adjusts the result into your desired unit. This calculator supports the two most common engineering units:
- Mils per year (mpy): Standard in the United States and oil & gas industries. (K = 3.45 × 106)
- Millimeters per year (mm/y): Standard metric unit. (K = 8.76 × 104)
What is an Acceptable Corrosion Rate?
Acceptability depends heavily on the application:
- Excellent: < 1 mpy (0.02 mm/y) — Required for critical parts like valves or pressure vessels.
- Good: 1–5 mpy (0.02–0.1 mm/y) — Acceptable for most piping and storage tanks.
- Fair: 5–20 mpy (0.1–0.5 mm/y) — Maintenance will be required; typical for some sacrificial parts.
- Poor: > 20 mpy (> 0.5 mm/y) — Generally unacceptable; material selection should be reconsidered.
Why Not Use a Static PDF?
While a "corrosion rate calculation pdf" often provides the formula or a nomograph, it requires manual calculation prone to human error. This digital tool automates the arithmetic, handles unit conversions instantly, and ensures that the relationship between density, time, and mass loss is applied correctly every time.