body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
line-height: 1.6;
color: #333;
max-width: 1200px;
margin: 0 auto;
padding: 20px;
background-color: #f4f7f6;
}
.calculator-wrapper {
background: #ffffff;
padding: 30px;
border-radius: 8px;
box-shadow: 0 4px 6px rgba(0,0,0,0.1);
margin-bottom: 40px;
border-top: 5px solid #2c3e50;
}
.calculator-grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 20px;
}
@media (max-width: 768px) {
.calculator-grid {
grid-template-columns: 1fr;
}
}
.input-group {
margin-bottom: 15px;
}
.input-group label {
display: block;
margin-bottom: 5px;
font-weight: 600;
color: #2c3e50;
}
.input-group input {
width: 100%;
padding: 10px;
border: 1px solid #ddd;
border-radius: 4px;
font-size: 16px;
box-sizing: border-box;
}
.input-group small {
color: #666;
font-size: 0.85em;
}
.calc-btn {
background-color: #e67e22;
color: white;
border: none;
padding: 12px 24px;
font-size: 16px;
font-weight: bold;
border-radius: 4px;
cursor: pointer;
width: 100%;
margin-top: 10px;
transition: background-color 0.3s;
}
.calc-btn:hover {
background-color: #d35400;
}
.results-section {
margin-top: 25px;
background-color: #f8f9fa;
border: 1px solid #e9ecef;
border-radius: 4px;
padding: 20px;
display: none;
}
.result-header {
font-size: 1.2em;
font-weight: bold;
color: #2c3e50;
margin-bottom: 15px;
border-bottom: 2px solid #ddd;
padding-bottom: 10px;
}
.result-row {
display: flex;
justify-content: space-between;
margin-bottom: 10px;
padding: 8px 0;
border-bottom: 1px dashed #ddd;
}
.result-label {
color: #555;
}
.result-value {
font-weight: bold;
color: #2c3e50;
}
.status-badge {
display: inline-block;
padding: 5px 10px;
border-radius: 4px;
font-weight: bold;
font-size: 0.9em;
color: white;
text-align: center;
width: 100%;
margin-top: 10px;
}
.status-safe { background-color: #27ae60; }
.status-warning { background-color: #f39c12; }
.status-danger { background-color: #c0392b; }
/* Content Styling */
.content-section {
background: white;
padding: 30px;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
h1, h2, h3 { color: #2c3e50; }
h1 { margin-bottom: 20px; font-size: 2.2em; }
p { margin-bottom: 15px; }
.formula-box {
background: #edf2f7;
padding: 15px;
border-left: 4px solid #2c3e50;
font-family: monospace;
margin: 20px 0;
}
ul { margin-bottom: 20px; padding-left: 20px; }
li { margin-bottom: 8px; }
table { width: 100%; border-collapse: collapse; margin: 20px 0; }
th, td { border: 1px solid #ddd; padding: 10px; text-align: left; }
th { background-color: #f2f2f2; }
function calculateCorrosion() {
// Get Input Values
var tInit = parseFloat(document.getElementById('initialThickness').value);
var tAct = parseFloat(document.getElementById('currentThickness').value);
var tMin = parseFloat(document.getElementById('minThickness').value);
var yInit = parseFloat(document.getElementById('installYear').value);
var yInsp = parseFloat(document.getElementById('inspectYear').value);
// Validation
if (isNaN(tInit) || isNaN(tAct) || isNaN(tMin) || isNaN(yInit) || isNaN(yInsp)) {
alert("Please fill in all fields with valid numbers.");
return;
}
if (yInsp <= yInit) {
alert("Inspection year must be later than installation year.");
return;
}
// Calculations
var timeSpan = yInsp – yInit;
var metalLoss = tInit – tAct;
// Handle negative loss (growth/error)
if (metalLoss < 0) {
metalLoss = 0;
}
var corrosionRate = metalLoss / timeSpan; // mm per year
var remainingAllowance = tAct – tMin;
var remainingLife = 0;
// Calculate Remaining Life
if (remainingAllowance <= 0) {
remainingLife = 0;
} else if (corrosionRate = 999) {
document.getElementById('resLife').innerText = "> 50 Years (Negligible Corrosion)";
document.getElementById('resRetireDate').innerText = "Indefinite";
} else {
document.getElementById('resLife').innerText = remainingLife.toFixed(2) + " Years";
document.getElementById('resRetireDate').innerText = Math.floor(retireYear);
}
// Status Logic
var statusEl = document.getElementById('statusMessage');
statusEl.className = 'status-badge'; // reset
if (remainingAllowance < 0) {
statusEl.innerText = "CRITICAL FAILURE: Thickness below minimum required!";
statusEl.classList.add('status-danger');
} else if (remainingLife < 5) {
statusEl.innerText = "WARNING: Asset approaching end of life (< 5 years)";
statusEl.classList.add('status-warning');
} else {
statusEl.innerText = "Asset Condition: Acceptable";
statusEl.classList.add('status-safe');
}
}
Corrosion Rate and Remaining Life Calculation (Excel Alternative)
In the field of asset integrity management (AIM) and non-destructive testing (NDT), determining the Corrosion Rate (CR) and Remaining Life (RL) of piping, pressure vessels, and storage tanks is critical for safety and compliance. While many engineers rely on complex Corrosion Rate and Remaining Life Calculation Excel sheets, this web-based tool provides an instant, error-free verification based on standard API 570 and API 510 formulas.
How to Calculate Corrosion Rate
The corrosion rate is defined as the speed at which the material deteriorates over time. It is typically measured in millimeters per year (mm/yr) or mils per year (mpy). To calculate the Long-Term Corrosion Rate (LTCR), we use the following formula:
Corrosion Rate (CR) = (Tnominal – Tactual) / (Dateinspection – Dateinstall)
Where:
- Tnominal: The original thickness of the material when installed (or the previous baseline thickness).
- Tactual: The current measured thickness from Ultrasonic Testing (UT).
- Time Interval: The duration between the installation date and the inspection date in years.
Determining Remaining Life of Equipment
Once the corrosion rate is established, the remaining life estimates how many years the asset can operate safely before reaching its retirement limit. This is calculated using the Remaining Corrosion Allowance.
Remaining Life (years) = (Tactual – Tmin) / Corrosion Rate
Tmin (Minimum Required Thickness) is the absolute floor for safety, calculated based on internal pressure, hoop stress, and structural requirements. When the equipment reaches this thickness, it must be repaired, derated, or retired.
Why Use a Web Calculator vs. Excel?
While Excel is the industry standard for managing bulk data (like thousands of Thickness Measurement Locations or TMLs), a dedicated web calculator offers specific advantages for spot checks and field reporting:
- Accessibility: Calculate results on a tablet or mobile device directly in the field during inspection.
- Validation: Prevents formula errors common in shared spreadsheets where cells are accidentally unlocked or modified.
- Visualization: Instantly flags critical assets (Red status) without needing to set up conditional formatting manually.
Example Calculation Case Study
Consider a Carbon Steel pipeline installed in 2012 with a nominal thickness of 12.7mm. An inspection in 2022 reveals the thickness has reduced to 11.2mm. The engineering design requires a minimum thickness of 8.0mm.
| Parameter |
Value |
| Total Metal Loss |
12.7mm – 11.2mm = 1.5mm |
| Time Duration |
2022 – 2012 = 10 Years |
| Corrosion Rate |
1.5mm / 10yr = 0.15 mm/yr |
| Remaining Allowance |
11.2mm – 8.0mm = 3.2mm |
| Remaining Life |
3.2mm / 0.15 = 21.33 Years |
Based on this calculation, the pipe is fit for service until approximately the year 2043, assuming the corrosion environment remains constant.