function updateDensity() {
var select = document.getElementById("materialSelect");
var densityInput = document.getElementById("densityInput");
var selectedValue = select.value;
if (selectedValue !== "custom" && selectedValue !== "") {
densityInput.value = selectedValue;
// Density is typically fixed for specific materials, so we can make it readonly or leave editable
// Leaving editable allows minor adjustments
} else if (selectedValue === "custom") {
densityInput.value = "";
densityInput.focus();
}
}
function calculateCorrosion() {
// Get Input Values
var density = parseFloat(document.getElementById("densityInput").value);
var area = parseFloat(document.getElementById("surfaceArea").value);
var wInitial = parseFloat(document.getElementById("initialWeight").value);
var wFinal = parseFloat(document.getElementById("finalWeight").value);
var time = parseFloat(document.getElementById("exposureTime").value);
// Validation
if (isNaN(density) || density <= 0) {
alert("Please enter a valid material density.");
return;
}
if (isNaN(area) || area <= 0) {
alert("Please enter a valid surface area.");
return;
}
if (isNaN(wInitial) || wInitial <= 0) {
alert("Please enter a valid initial weight.");
return;
}
if (isNaN(wFinal) || wFinal <= 0) {
alert("Please enter a valid final weight.");
return;
}
if (isNaN(time) || time = wInitial) {
alert("Final weight must be less than initial weight to calculate mass loss corrosion.");
return;
}
// Calculations based on ASTM G1
// K factor for MPY = 3.45 x 10^6 (if Area in cm², Time in hours, Weight in grams, Density in g/cm³)
// Wait, standard constant K for MPY:
// Formula: MPY = (K * W) / (A * T * D)
// K = 3.45 x 10^6 if W in grams, A in cm², T in hours, D in g/cm³
var weightLossGrams = wInitial – wFinal;
var K_mpy = 3.45 * Math.pow(10, 6);
var K_mmy = 8.76 * Math.pow(10, 4);
var mpy = (K_mpy * weightLossGrams) / (area * time * density);
var mmpy = (K_mmy * weightLossGrams) / (area * time * density);
// Display Results
document.getElementById("resultsSection").style.display = "block";
document.getElementById("resWeightLoss").innerText = weightLossGrams.toFixed(4) + " g";
document.getElementById("resMPY").innerText = mpy.toFixed(4) + " mpy";
document.getElementById("resMMPY").innerText = mmpy.toFixed(4) + " mm/y";
// Classification (General Steel Reference)
// 20 MPY: Severe
var statusEl = document.getElementById("resStatus");
var statusText = "";
// Reset classes
statusEl.className = "status-indicator";
if (mpy < 1) {
statusText = "Outstanding";
statusEl.classList.add("status-low");
} else if (mpy < 5) {
statusText = "Good/Excellent";
statusEl.classList.add("status-low");
} else if (mpy < 20) {
statusText = "Moderate/Fair";
statusEl.classList.add("status-moderate");
} else if (mpy < 50) {
statusText = "High/Poor";
statusEl.classList.add("status-high");
} else {
statusText = "Severe";
statusEl.classList.add("status-severe");
}
statusEl.innerText = statusText;
}
function clearCalculator() {
document.getElementById("materialSelect").value = "";
document.getElementById("densityInput").value = "";
document.getElementById("surfaceArea").value = "";
document.getElementById("initialWeight").value = "";
document.getElementById("finalWeight").value = "";
document.getElementById("exposureTime").value = "";
document.getElementById("resultsSection").style.display = "none";
}
Corrosion Rate Calculation Software & Online Tool
Corrosion monitoring is a critical aspect of asset integrity management in industries ranging from oil and gas to marine infrastructure. This Corrosion Rate Calculation Software tool allows engineers, metallurgists, and lab technicians to quickly determine the rate of material degradation based on standard weight-loss methods derived from ASTM G1 and NACE standards.
How to Use This Calculator
This tool replaces complex manual spreadsheets by automating the standard corrosion formulas. To obtain accurate results, follow these steps:
Select Material: Choose a preset metal to automatically fill the density field, or select "Custom" to input a specific alloy density manually.
Input Surface Area: Enter the total exposed surface area of the coupon in square centimeters ($cm^2$).
Enter Weights: Input the initial weight of the coupon before exposure and the final weight after cleaning (in grams). The software calculates the mass loss automatically.
Exposure Time: Input the total duration the material was exposed to the corrosive environment in hours.
The Mathematics Behind the Software
The calculation performed by this tool uses the widely accepted formula:
$$CR = \frac{K \times W}{A \times T \times D}$$
Where:
CR: Corrosion Rate
K: Constant ($3.45 \times 10^6$ for MPY when area is in $cm^2$)
W: Weight loss in grams ($g$)
A: Surface Area in $cm^2$
T: Time in hours ($h$)
D: Density in $g/cm^3$
Understanding the Results: MPY vs. mm/y
The software outputs two primary metrics used globally for corrosion reporting:
MPY (Mils Per Year): The most common unit in the United States and the oil/gas industry. One "mil" is equal to one-thousandth of an inch (0.001″).
mm/y (Millimeters Per Year): The standard metric unit used in scientific research and European industries.
Interpreting Severity
While acceptable corrosion rates vary by application (e.g., a pressure vessel requires stricter limits than a drainage pipe), general industry guidelines for Carbon Steel are often categorized as follows:
< 1 MPY: Outstanding (Low corrosivity)
1 – 5 MPY: Good to Excellent
5 – 20 MPY: Moderate (Process changes may be required)
> 20 MPY: High/Severe (Material upgrade or inhibition required)
Why Use Online Calculation Software?
Manual calculations are prone to unit conversion errors—specifically between imperial and metric area measurements or density units. This cloud-based calculation software standardizes the constants ($K$ values) ensuring that whether you input data for Carbon Steel or Titanium, the resulting corrosion rate is mathematically precise according to ASTM G1 guidelines.