mauryaR8's picture
Add 3 files
036cfab verified
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Interactive Landfill Simulation</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
.landfill-layer {
transition: all 2s ease;
}
.leachate-flow {
animation: leachateFlow 3s infinite;
}
.gas-bubble {
animation: gasBubble 2s infinite ease-out;
opacity: 0;
}
.settlement-effect {
transition: height 3s ease, bottom 3s ease;
}
@keyframes leachateFlow {
0% { opacity: 0.3; }
50% { opacity: 0.8; }
100% { opacity: 0.3; }
}
@keyframes gasBubble {
0% { transform: translateY(0); opacity: 0; }
20% { opacity: 0.7; }
100% { transform: translateY(-100px); opacity: 0; }
}
.progress-bar {
transition: width 1s ease;
}
</style>
</head>
<body class="bg-gray-100 min-h-screen">
<div class="container mx-auto px-4 py-8">
<h1 class="text-4xl font-bold text-center text-green-800 mb-8">Landfill Interactive Simulation</h1>
<div class="bg-white rounded-lg shadow-xl p-6 mb-8">
<div class="flex flex-wrap gap-4 mb-6">
<div class="flex-1 min-w-[200px]">
<label class="block text-sm font-medium text-gray-700 mb-1">Waste Depth (m)</label>
<input type="range" id="wasteDepth" min="5" max="30" value="15" class="w-full">
<div class="flex justify-between text-xs text-gray-500">
<span>5m</span>
<span>30m</span>
</div>
</div>
<div class="flex-1 min-w-[200px]">
<label class="block text-sm font-medium text-gray-700 mb-1">Moisture Content (%)</label>
<input type="range" id="moistureContent" min="10" max="60" value="30" class="w-full">
<div class="flex justify-between text-xs text-gray-500">
<span>10%</span>
<span>60%</span>
</div>
</div>
<div class="flex-1 min-w-[200px]">
<label class="block text-sm font-medium text-gray-700 mb-1">Organic Content (%)</label>
<input type="range" id="organicContent" min="10" max="70" value="40" class="w-full">
<div class="flex justify-between text-xs text-gray-500">
<span>10%</span>
<span>70%</span>
</div>
</div>
<div class="flex-1 min-w-[200px]">
<label class="block text-sm font-medium text-gray-700 mb-1">Time (years)</label>
<input type="range" id="timeYears" min="1" max="30" value="5" class="w-full">
<div class="flex justify-between text-xs text-gray-500">
<span>1yr</span>
<span>30yr</span>
</div>
</div>
</div>
<div class="flex gap-4 mb-6">
<button id="startSimulation" class="bg-green-600 hover:bg-green-700 text-white px-4 py-2 rounded-lg flex items-center gap-2">
<i class="fas fa-play"></i> Start Simulation
</button>
<button id="resetSimulation" class="bg-gray-600 hover:bg-gray-700 text-white px-4 py-2 rounded-lg flex items-center gap-2">
<i class="fas fa-redo"></i> Reset
</button>
<button id="showInfo" class="bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-lg flex items-center gap-2">
<i class="fas fa-info-circle"></i> Info Panel
</button>
</div>
</div>
<div class="relative bg-white rounded-lg shadow-xl p-6 mb-8 overflow-hidden">
<div id="simulationContainer" class="relative h-[500px] border-2 border-gray-300 rounded-lg">
<!-- Base liner -->
<div class="absolute bottom-0 left-0 right-0 h-8 bg-gray-400 flex justify-center">
<div class="w-full max-w-[90%] h-full bg-gray-500 relative">
<div class="absolute left-0 top-0 h-full w-6 bg-gray-600"></div>
<div class="absolute right-0 top-0 h-full w-6 bg-gray-600"></div>
<div class="absolute left-1/2 -translate-x-1/2 top-0 h-full w-12 bg-gray-400 flex justify-center items-center">
<i class="fas fa-layer-group text-gray-700"></i>
</div>
</div>
</div>
<!-- Landfill cells will be generated here -->
<div id="landfillCells" class="absolute bottom-8 left-0 right-0"></div>
<!-- Leachate collection system -->
<div class="absolute bottom-8 left-0 right-0 h-4 bg-blue-100 flex justify-center">
<div class="w-full max-w-[90%] h-full bg-blue-300 relative">
<div class="absolute left-0 top-0 h-full w-6 bg-blue-500"></div>
<div class="absolute right-0 top-0 h-full w-6 bg-blue-500"></div>
<div class="absolute left-1/2 -translate-x-1/2 top-0 h-full w-12 bg-blue-400 flex justify-center items-center">
<i class="fas fa-tint text-blue-700"></i>
</div>
</div>
</div>
<!-- Leachate flow animation (hidden by default) -->
<div id="leachateFlow" class="absolute bottom-12 left-0 right-0 h-2 bg-blue-400 opacity-0 leachate-flow hidden"></div>
<!-- Gas collection system -->
<div id="gasCollection" class="absolute top-4 left-1/2 -translate-x-1/2 w-16 h-16 bg-gray-200 rounded-full flex items-center justify-center">
<i class="fas fa-fire text-yellow-500 text-xl"></i>
<div class="absolute -bottom-4 left-1/2 -translate-x-1/2 w-8 h-8 bg-gray-300 rounded-full"></div>
</div>
<!-- Gas bubbles (hidden by default) -->
<div id="gasBubbles" class="absolute hidden">
<div class="absolute w-4 h-4 rounded-full bg-yellow-200 gas-bubble" style="left: 20%; bottom: 30%;"></div>
<div class="absolute w-3 h-3 rounded-full bg-yellow-200 gas-bubble" style="left: 35%; bottom: 25%; animation-delay: 0.5s;"></div>
<div class="absolute w-5 h-5 rounded-full bg-yellow-200 gas-bubble" style="left: 50%; bottom: 35%; animation-delay: 1s;"></div>
<div class="absolute w-3 h-3 rounded-full bg-yellow-200 gas-bubble" style="left: 65%; bottom: 30%; animation-delay: 1.5s;"></div>
<div class="absolute w-4 h-4 rounded-full bg-yellow-200 gas-bubble" style="left: 80%; bottom: 25%; animation-delay: 0.8s;"></div>
</div>
</div>
<div class="mt-6 grid grid-cols-1 md:grid-cols-3 gap-4">
<div class="bg-blue-50 p-4 rounded-lg border border-blue-200">
<h3 class="font-bold text-blue-800 mb-2">Leachate Generation</h3>
<div class="h-4 bg-blue-100 rounded-full mb-2">
<div id="leachateBar" class="h-full bg-blue-500 rounded-full progress-bar w-0"></div>
</div>
<p class="text-sm text-gray-600">Volume: <span id="leachateVolume">0</span> m³/day</p>
</div>
<div class="bg-yellow-50 p-4 rounded-lg border border-yellow-200">
<h3 class="font-bold text-yellow-800 mb-2">Gas Emission</h3>
<div class="h-4 bg-yellow-100 rounded-full mb-2">
<div id="gasBar" class="h-full bg-yellow-500 rounded-full progress-bar w-0"></div>
</div>
<p class="text-sm text-gray-600">Methane: <span id="methaneVolume">0</span> m³/day</p>
</div>
<div class="bg-gray-50 p-4 rounded-lg border border-gray-200">
<h3 class="font-bold text-gray-800 mb-2">Settlement</h3>
<div class="h-4 bg-gray-100 rounded-full mb-2">
<div id="settlementBar" class="h-full bg-gray-500 rounded-full progress-bar w-0"></div>
</div>
<p class="text-sm text-gray-600">Total: <span id="settlementAmount">0</span> cm</p>
</div>
</div>
</div>
<div id="infoPanel" class="bg-white rounded-lg shadow-xl p-6 hidden">
<h2 class="text-2xl font-bold text-gray-800 mb-4">Landfill Components Explained</h2>
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
<div class="bg-blue-50 p-4 rounded-lg">
<h3 class="font-bold text-blue-800 mb-2 flex items-center gap-2">
<i class="fas fa-tint"></i> Leachate System
</h3>
<p class="text-gray-700 mb-2">Leachate is liquid that drains from the waste. This simulation shows:</p>
<ul class="list-disc pl-5 text-sm text-gray-600">
<li>Generation based on moisture content</li>
<li>Flow through waste layers</li>
<li>Collection at the base</li>
</ul>
</div>
<div class="bg-yellow-50 p-4 rounded-lg">
<h3 class="font-bold text-yellow-800 mb-2 flex items-center gap-2">
<i class="fas fa-fire"></i> Gas Collection
</h3>
<p class="text-gray-700 mb-2">Biodegradation produces landfill gas (mainly methane and CO₂):</p>
<ul class="list-disc pl-5 text-sm text-gray-600">
<li>Gas generation depends on organic content</li>
<li>Vertical wells collect gas</li>
<li>Can be used for energy production</li>
</ul>
</div>
<div class="bg-green-50 p-4 rounded-lg">
<h3 class="font-bold text-green-800 mb-2 flex items-center gap-2">
<i class="fas fa-layer-group"></i> Waste Layers
</h3>
<p class="text-gray-700 mb-2">Waste is placed in compacted layers:</p>
<ul class="list-disc pl-5 text-sm text-gray-600">
<li>Daily cover reduces odors and pests</li>
<li>Intermediate cover separates waste lifts</li>
<li>Final cover seals completed landfill</li>
</ul>
</div>
<div class="bg-gray-50 p-4 rounded-lg">
<h3 class="font-bold text-gray-800 mb-2 flex items-center gap-2">
<i class="fas fa-arrow-down"></i> Settlement
</h3>
<p class="text-gray-700 mb-2">Waste compacts over time due to:</p>
<ul class="list-disc pl-5 text-sm text-gray-600">
<li>Mechanical compression</li>
<li>Biodegradation of organics</li>
<li>Moisture movement</li>
</ul>
</div>
</div>
</div>
</div>
<script>
document.addEventListener('DOMContentLoaded', function() {
// Get DOM elements
const startBtn = document.getElementById('startSimulation');
const resetBtn = document.getElementById('resetSimulation');
const infoBtn = document.getElementById('showInfo');
const infoPanel = document.getElementById('infoPanel');
const landfillCells = document.getElementById('landfillCells');
const leachateFlow = document.getElementById('leachateFlow');
const gasBubbles = document.getElementById('gasBubbles');
// Metrics elements
const leachateVolume = document.getElementById('leachateVolume');
const methaneVolume = document.getElementById('methaneVolume');
const settlementAmount = document.getElementById('settlementAmount');
const leachateBar = document.getElementById('leachateBar');
const gasBar = document.getElementById('gasBar');
const settlementBar = document.getElementById('settlementBar');
// Input sliders
const wasteDepthInput = document.getElementById('wasteDepth');
const moistureContentInput = document.getElementById('moistureContent');
const organicContentInput = document.getElementById('organicContent');
const timeYearsInput = document.getElementById('timeYears');
// Simulation variables
let simulationInterval;
let currentTime = 0;
let maxTime = 30;
let originalLayerHeights = [];
// Initialize landfill cells
function initializeLandfill() {
landfillCells.innerHTML = '';
originalLayerHeights = [];
const wasteDepth = parseInt(wasteDepthInput.value);
const totalHeight = wasteDepth * 10; // Scale for visualization
const layerCount = 5;
const layerHeight = totalHeight / layerCount;
// Create waste cells with different colors for layers
for (let i = 0; i < layerCount; i++) {
const cell = document.createElement('div');
const colorShade = 700 - i * 100;
cell.className = `landfill-layer absolute left-0 right-0 bg-green-${colorShade} border-t border-green-${colorShade + 100} settlement-effect`;
cell.style.height = `${layerHeight}px`;
cell.style.bottom = `${8 + i * layerHeight}px`;
landfillCells.appendChild(cell);
// Store original heights for settlement calculation
originalLayerHeights.push({
height: layerHeight,
bottom: 8 + i * layerHeight
});
}
// Reset metrics
leachateVolume.textContent = '0';
methaneVolume.textContent = '0';
settlementAmount.textContent = '0';
leachateBar.style.width = '0%';
gasBar.style.width = '0%';
settlementBar.style.width = '0%';
// Hide animations
leachateFlow.classList.add('hidden');
gasBubbles.classList.add('hidden');
// Reset time
currentTime = 0;
}
// Run simulation
function runSimulation() {
clearInterval(simulationInterval);
const moisture = parseInt(moistureContentInput.value);
const organic = parseInt(organicContentInput.value);
const years = parseInt(timeYearsInput.value);
maxTime = years;
currentTime = 0;
// Calculate base values based on inputs
const baseLeachate = moisture * 0.2;
const baseGas = organic * 0.5;
const baseSettlement = organic * 0.3;
// Show initial animations if values are high enough
if (moisture > 20) {
leachateFlow.classList.remove('hidden');
}
if (organic > 20) {
gasBubbles.classList.remove('hidden');
}
simulationInterval = setInterval(() => {
if (currentTime >= maxTime) {
clearInterval(simulationInterval);
return;
}
currentTime += 0.5; // Increment by 0.5 years each step
// Calculate metrics based on time and inputs
const timeFactor = currentTime / maxTime;
const leachateValue = Math.round(baseLeachate * (1 + timeFactor * 2));
const gasValue = Math.round(baseGas * (timeFactor < 0.5 ? timeFactor * 2 : 1 - (timeFactor - 0.5) * 0.8));
const settlementValue = Math.round(baseSettlement * timeFactor * 3);
// Update metrics display
leachateVolume.textContent = leachateValue;
methaneVolume.textContent = gasValue;
settlementAmount.textContent = settlementValue;
// Update progress bars
leachateBar.style.width = `${Math.min(100, leachateValue / 50 * 100)}%`;
gasBar.style.width = `${Math.min(100, gasValue / 40 * 100)}%`;
settlementBar.style.width = `${Math.min(100, settlementValue / 50 * 100)}%`;
// Apply settlement effect to each layer
const cells = document.querySelectorAll('.landfill-layer');
const settlementFactor = settlementValue / 50;
cells.forEach((cell, index) => {
const original = originalLayerHeights[index];
const newHeight = original.height * (1 - settlementFactor * 0.1 * (cells.length - index)/cells.length);
const newBottom = original.bottom * (1 - settlementFactor * 0.05 * (cells.length - index)/cells.length);
cell.style.height = `${newHeight}px`;
cell.style.bottom = `${newBottom}px`;
});
}, 1000); // Update every second
}
// Event listeners
startBtn.addEventListener('click', runSimulation);
resetBtn.addEventListener('click', initializeLandfill);
infoBtn.addEventListener('click', () => {
infoPanel.classList.toggle('hidden');
});
// Initialize on load
initializeLandfill();
// Update landfill when depth changes
wasteDepthInput.addEventListener('input', initializeLandfill);
});
</script>
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=mauryaR8/landfill-interactive-simulation" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html>