Calculate Saturated Unit Weight of Soil

Saturated Unit Weight of Soil Calculator & Guide :root { –primary-color: #004a99; –success-color: #28a745; –background-color: #f8f9fa; –text-color: #333; –border-color: #ccc; –shadow-color: rgba(0, 0, 0, 0.1); } body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background-color: var(–background-color); color: var(–text-color); line-height: 1.6; margin: 0; padding: 0; display: flex; flex-direction: column; align-items: center; } .container { width: 100%; max-width: 960px; margin: 20px auto; padding: 20px; background-color: #fff; box-shadow: 0 4px 8px var(–shadow-color); border-radius: 8px; box-sizing: border-box; } header { background-color: var(–primary-color); color: #fff; padding: 20px; text-align: center; width: 100%; border-radius: 8px 8px 0 0; } header h1 { margin: 0; font-size: 2.2em; letter-spacing: 1px; } main { padding: 20px 0; } section { margin-bottom: 30px; padding: 20px; background-color: #fff; border-radius: 8px; box-shadow: 0 2px 4px var(–shadow-color); } h2, h3 { color: var(–primary-color); margin-top: 0; border-bottom: 2px solid var(–primary-color); padding-bottom: 8px; margin-bottom: 15px; } .loan-calc-container { background-color: #fff; padding: 25px; border-radius: 8px; box-shadow: 0 2px 4px var(–shadow-color); margin-bottom: 30px; } .input-group { margin-bottom: 20px; display: flex; flex-direction: column; align-items: flex-start; } .input-group label { font-weight: bold; margin-bottom: 8px; color: var(–text-color); display: block; } .input-group input[type="number"], .input-group input[type="text"], .input-group select { width: calc(100% – 20px); padding: 10px; border: 1px solid var(–border-color); border-radius: 4px; font-size: 1em; box-sizing: border-box; transition: border-color 0.3s ease; } .input-group input[type="number"]:focus, .input-group input[type="text"]:focus, .input-group select:focus { border-color: var(–primary-color); outline: none; } .input-group .helper-text { font-size: 0.85em; color: #666; margin-top: 5px; } .error-message { color: #dc3545; font-size: 0.8em; margin-top: 5px; display: none; /* Hidden by default */ } .error-message.visible { display: block; } .button-group { display: flex; justify-content: space-between; margin-top: 20px; gap: 10px; } .button-group button { padding: 12px 20px; border: none; border-radius: 5px; cursor: pointer; font-size: 1em; font-weight: bold; transition: background-color 0.3s ease, transform 0.2s ease; flex-grow: 1; } .btn-primary { background-color: var(–primary-color); color: white; } .btn-primary:hover { background-color: #003366; transform: translateY(-2px); } .btn-secondary { background-color: #6c757d; color: white; } .btn-secondary:hover { background-color: #5a6268; transform: translateY(-2px); } .btn-reset { background-color: #ffc107; color: #212529; } .btn-reset:hover { background-color: #e0a800; transform: translateY(-2px); } .result-container { margin-top: 30px; padding: 20px; background-color: var(–primary-color); color: white; border-radius: 8px; text-align: center; box-shadow: 0 2px 6px var(–shadow-color); } .result-container h3 { color: white; border-bottom: 1px solid white; padding-bottom: 10px; margin-bottom: 15px; } .primary-result { font-size: 2.5em; font-weight: bold; margin-bottom: 15px; display: block; } .intermediate-results div, .formula-explanation div { margin-bottom: 10px; font-size: 0.95em; } .intermediate-results span, .formula-explanation span { font-weight: bold; display: inline-block; min-width: 200px; } table { width: 100%; border-collapse: collapse; margin-top: 20px; margin-bottom: 30px; box-shadow: 0 2px 4px var(–shadow-color); border-radius: 8px; overflow: hidden; /* For rounded corners on table */ } th, td { padding: 12px 15px; text-align: left; border-bottom: 1px solid #ddd; } thead th { background-color: var(–primary-color); color: white; font-weight: bold; } tbody tr:nth-child(even) { background-color: #f2f2f2; } tbody tr:hover { background-color: #e2e2e2; } caption { font-weight: bold; font-size: 1.1em; color: var(–text-color); margin-bottom: 10px; text-align: left; caption-side: top; } .chart-container { background-color: #fff; padding: 20px; border-radius: 8px; box-shadow: 0 2px 4px var(–shadow-color); text-align: center; margin-top: 30px; } .chart-container h3 { color: var(–primary-color); margin-bottom: 20px; } #soilChart { max-width: 100%; height: 300px; } footer { text-align: center; padding: 20px; margin-top: 30px; width: 100%; background-color: var(–primary-color); color: #fff; border-radius: 0 0 8px 8px; } /* Responsive adjustments */ @media (max-width: 600px) { .container { padding: 15px; } header h1 { font-size: 1.8em; } .button-group { flex-direction: column; } .button-group button { width: 100%; margin-bottom: 10px; } .button-group button:last-child { margin-bottom: 0; } .primary-result { font-size: 2em; } } /* Specific styles for internal links */ .internal-links-section ul { list-style: none; padding: 0; } .internal-links-section li { margin-bottom: 15px; border-bottom: 1px dashed #eee; padding-bottom: 10px; } .internal-links-section li:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; } .internal-links-section a { color: var(–primary-color); text-decoration: none; font-weight: bold; } .internal-links-section a:hover { text-decoration: underline; } .internal-links-section p { font-size: 0.9em; color: #555; margin-top: 5px; }

Saturated Unit Weight of Soil Calculator

The ratio of the soil's weight to the weight of an equal volume of water. Typically 2.65 to 2.80 for mineral soils.
The ratio of the weight of water to the weight of soil solids, expressed as a percentage (e.g., 20%).
The ratio of the volume of voids to the volume of soil solids (e.g., 0.75).
The ratio of the volume of water to the volume of voids, expressed as a percentage (e.g., 100% for saturated soil).

Calculation Results

0.00
Unit Weight of Water (γw): 9.81 kN/m³ (Assumed)
Dry Unit Weight (γd): 0.00 kN/m³
Saturated Unit Weight (γsat): 0.00 kN/m³

Formula Used:

The saturated unit weight (γsat) of soil is calculated using the formula:
γsat = (Gs + e*S) / (1 + e) * γw
Where:

  • Gs = Soil Specific Gravity
  • e = Void Ratio
  • S = Degree of Saturation (as a decimal)
  • γw = Unit Weight of Water
When the soil is fully saturated (S=1 or 100%), the formula simplifies to:
γsat = (Gs + e) / (1 + e) * γw

Soil Properties and Unit Weight Variations
Soil Type Typical Specific Gravity (Gs) Typical Void Ratio (e) Saturation Level Calculated Saturated Unit Weight (γsat) (kN/m³)
Sand (Dense) 2.65 0.40 100% N/A
Clay (Medium) 2.70 0.80 100% N/A
Silt (Loose) 2.68 1.20 100% N/A
Gravel (Coarse) 2.75 0.30 100% N/A

Impact of Void Ratio on Saturated Unit Weight

What is Saturated Unit Weight of Soil?

The saturated unit weight of soil (often denoted as γsat) is a fundamental geotechnical property that represents the total weight of a soil mass per unit volume when all the voids within that soil mass are completely filled with water. This metric is crucial in understanding how soil behaves under load, its stability, and its bearing capacity, particularly in environments where groundwater is present or the soil is submerged.

Who should use it? This calculator and the understanding of saturated unit weight are essential for geotechnical engineers, civil engineers, construction professionals, environmental consultants, and students studying soil mechanics. Anyone involved in designing foundations, earth retaining structures, tunnels, roads, or managing slopes will find this information vital. It helps in predicting settlement, potential for liquefaction, and the overall stability of soil structures.

Common misconceptions about soil unit weights often revolve around assuming a single value applies universally. In reality, the unit weight is highly dependent on the soil's composition, particle characteristics, void spaces, and water content. Another misconception is that the saturated unit weight is simply the dry unit weight plus the weight of water; while related, the calculation is more nuanced, involving specific gravity and void ratio.

Saturated Unit Weight of Soil Formula and Mathematical Explanation

The saturated unit weight of soil is derived from the basic principles of soil mechanics and the relationships between soil solids, water, and air. The general formula for the unit weight of a soil mass (γ) is:

γ = (Weight of Soil Mass) / (Volume of Soil Mass)

For saturated soil, the volume of air is zero, and all void spaces are filled with water. The total volume (V) can be broken down into the volume of solids (Vs) and the volume of voids (Vv). The volume of voids (Vv) is entirely filled with water, so the volume of water (Vw) equals Vv. The weight of the soil mass is the sum of the weight of solids (Ws) and the weight of water (Ww).

Step-by-step derivation:

  1. Start with the definition of void ratio (e): e = Vv / Vs
  2. The volume of water is Vw = Vv = e * Vs
  3. The weight of solids is Ws = Gs * γw * Vs, where Gs is the specific gravity of soil solids and γw is the unit weight of water.
  4. The weight of water is Ww = Vw * γw = (e * Vs) * γw
  5. The total weight of the saturated soil mass is Wsat = Ws + Ww = (Gs * γw * Vs) + (e * γw * Vs) = Vs * γw * (Gs + e)
  6. The total volume of the saturated soil mass is V = Vs + Vv = Vs + e * Vs = Vs * (1 + e)
  7. The saturated unit weight (γsat) is Wsat / V:
  8. γsat = [Vs * γw * (Gs + e)] / [Vs * (1 + e)]
  9. Simplifying, we get: γsat = [(Gs + e) / (1 + e)] * γw

This formula holds true for fully saturated soil. If the soil is partially saturated (S < 100%), the formula is more general: γ = [(Gs + e*S) / (1 + e)] * γw where S is the degree of saturation expressed as a decimal.

Variable Explanations

Variables in the Saturated Unit Weight Formula
Variable Meaning Unit Typical Range
γsat Saturated Unit Weight of Soil kN/m³ (or lb/ft³) 17 – 22 kN/m³ (typical for many soils)
Gs Specific Gravity of Soil Solids Dimensionless 2.65 – 2.80 (mineral soils)
e Void Ratio Dimensionless 0.1 – 2.0+ (highly variable)
S Degree of Saturation Dimensionless (or %) 0 – 1 (or 0% – 100%)
γw Unit Weight of Water kN/m³ (or lb/ft³) 9.81 kN/m³ (at standard conditions)

Practical Examples (Real-World Use Cases)

Understanding the saturated unit weight of soil is critical for various engineering applications. Here are two practical examples:

Example 1: Foundation Design for a Building on Clay

A geotechnical engineer is evaluating a site for a new building. Soil borings reveal a thick layer of clay with the following properties:

  • Specific Gravity (Gs) = 2.70
  • Void Ratio (e) = 0.90
  • Degree of Saturation (S) = 95% (partially saturated, but approaching saturation due to high groundwater table)

The engineer needs to estimate the soil's weight when saturated to assess bearing capacity and potential settlement. Assuming the unit weight of water (γw) is 9.81 kN/m³.

First, convert S to a decimal: S = 0.95.

Calculate the saturated unit weight (γsat) using the general formula: γsat = [(Gs + e*S) / (1 + e)] * γw γsat = [(2.70 + 0.90 * 0.95) / (1 + 0.90)] * 9.81 γsat = [(2.70 + 0.855) / 1.90] * 9.81 γsat = [3.555 / 1.90] * 9.81 γsat ≈ 1.871 * 9.81 γsat ≈ 18.35 kN/m³

Interpretation: This value represents the soil's weight per cubic meter when nearly saturated. Engineers use this to calculate the total load on the foundation and compare it against the soil's bearing capacity, ensuring the foundation is adequately designed to prevent failure. The relatively high void ratio of the clay indicates it can hold a significant amount of water, making the saturated condition important.

Example 2: Embankment Stability Analysis Near a River

An engineer is designing an embankment for a road that will be located adjacent to a river. The embankment fill material is a compacted sand with the following properties:

  • Specific Gravity (Gs) = 2.65
  • Void Ratio (e) = 0.50
  • The embankment is expected to be fully saturated due to proximity to the river and potential flooding. S = 100% (or 1.0)

Assuming the unit weight of water (γw) is 9.81 kN/m³.

Calculate the saturated unit weight (γsat) using the simplified formula for S=1: γsat = [(Gs + e) / (1 + e)] * γw γsat = [(2.65 + 0.50) / (1 + 0.50)] * 9.81 γsat = [3.15 / 1.50] * 9.81 γsat = 2.10 * 9.81 γsat ≈ 20.60 kN/m³

Interpretation: This saturated unit weight is used in slope stability analyses for the embankment. Higher unit weights increase the driving forces (gravity acting on the soil mass) that can lead to slope failure, especially when subjected to seismic forces or rapid drawdown of water levels. Understanding this value helps in determining the required factor of safety for the embankment slopes. This value is also crucial when considering soil mechanics principles.

How to Use This Saturated Unit Weight of Soil Calculator

Our Saturated Unit Weight of Soil Calculator is designed for simplicity and accuracy. Follow these steps to get your results:

  1. Identify Your Soil Parameters: You will need the Specific Gravity (Gs) of the soil solids, the Void Ratio (e), and the Degree of Saturation (S). If your soil is fully saturated, set S to 100%. If it's partially saturated, determine the actual percentage of void space filled with water. You might also need the Unit Weight of Water (γw), which is typically assumed to be 9.81 kN/m³ (or 62.4 lb/ft³).
  2. Input Values: Enter the known values into the corresponding fields: "Soil Specific Gravity (Gs)", "Water Content (w)" (Note: The calculator uses Void Ratio (e) directly, but if you have Water Content and Gs, you can calculate 'e' using e = w * Gs), "Void Ratio (e)", and "Degree of Saturation (S)". Pay close attention to the units and typical ranges provided as helper text.
  3. Perform Calculation: Click the "Calculate" button. The calculator will process your inputs and display the results.
  4. Understand the Results:
    • Primary Result (Saturated Unit Weight – γsat): This is the main output, showing the calculated weight of the soil per unit volume when fully saturated, in kN/m³.
    • Intermediate Values: You'll see the Unit Weight of Water used in the calculation and the calculated Dry Unit Weight (γd), which is a related but distinct soil property.
    • Formula Explanation: A brief explanation of the formula used is provided for clarity.
  5. Interpreting Results for Decision Making:
    • Higher γsat: Generally indicates denser soil or soil with a higher mineral content, which might have better load-bearing capacity but can also mean higher self-weight contributing to settlement or instability.
    • Lower γsat: Often associated with looser soils or soils with higher organic content, which might be more compressible or susceptible to erosion.
    • Saturation Level: A high degree of saturation significantly increases the unit weight compared to a dry or partially saturated state, impacting effective stresses and stability. This is critical for submerged structures or foundations in areas with high water tables.
  6. Copy and Reset: Use the "Copy Results" button to save your calculated values and assumptions. The "Reset" button allows you to clear the fields and start over with default values.

Key Factors That Affect Saturated Unit Weight of Soil Results

Several factors influence the calculated saturated unit weight of soil. Understanding these can help in refining your calculations and interpreting the results more effectively:

  • Specific Gravity (Gs): This value is primarily determined by the mineral composition of the soil particles. Denser minerals result in a higher Gs. For example, quartz-based sands have a typical Gs of 2.65, while soils with mica or other heavier minerals might have a higher Gs. This directly increases the soil's unit weight.
  • Void Ratio (e): This is arguably the most significant factor. It represents the amount of pore space within the soil. Soils with high void ratios (like loose sands or soft clays) can hold more water when saturated, leading to a higher saturated unit weight than a dense soil with the same Gs. The relationship is inverse for dry unit weight but direct for saturated unit weight.
  • Degree of Saturation (S): While the calculator assumes 100% saturation for γsat, in reality, soils can be partially saturated. The degree of saturation dictates how much of the void volume is filled with water. Higher saturation means more water contributing to the total weight, thus increasing the unit weight towards its saturated value. This is critical for understanding effective stresses and pore water pressure.
  • Unit Weight of Water (γw): Although often treated as a constant (9.81 kN/m³), the unit weight of water can vary slightly with temperature and salinity. In extreme conditions or specific problem contexts, a more precise value might be necessary. Fluctuations in groundwater can affect the effective stresses on soil layers.
  • Compaction Effort and Soil Structure: The way soil is deposited or compacted significantly affects its void ratio. Well-graded, densely compacted soils tend to have lower void ratios and thus lower saturated unit weights compared to poorly graded, loosely deposited soils, assuming similar mineralogy. This impacts the bearing capacity.
  • Particle Shape and Gradation: While Gs reflects mineralogy, particle shape (e.g., rounded vs. angular) and gradation (mix of particle sizes) influence how particles pack together, affecting the achievable void ratio. Angular particles in a poorly graded soil might lead to higher void ratios than rounded particles in a well-graded soil, thus affecting γsat.
  • Presence of Organic Matter: Soils with significant organic content tend to have lower specific gravities and higher void ratios, resulting in lower saturated unit weights compared to mineral soils. Organic soils are also more compressible.

Frequently Asked Questions (FAQ)

Q1: What is the difference between dry unit weight (γd), moist unit weight (γm), and saturated unit weight (γsat)?

Dry Unit Weight (γd): Weight of soil solids per unit volume of total soil (air and solids). Assumes no water.
Moist Unit Weight (γm): Total weight (solids + water) per unit volume of total soil. This is the weight of soil as it appears in the field.
Saturated Unit Weight (γsat): Total weight (solids + water) per unit volume of total soil, where all voids are filled with water. It's always greater than moist or dry unit weight for the same soil.

Q2: Can the saturated unit weight be negative?

No, the saturated unit weight of soil cannot be negative. Unit weight represents a mass per volume, and both mass and volume are positive quantities. Specific gravity (Gs) and void ratio (e) are positive, and the unit weight of water (γw) is positive. Therefore, the calculated γsat will always be positive.

Q3: How does saturation affect the soil's strength?

Increased saturation generally leads to a decrease in the effective stress within the soil (due to increased pore water pressure), which in turn reduces the soil's shear strength. While the saturated unit weight itself is higher, the strength mobilized by the soil mass can be lower due to the presence of water. This is a critical consideration in slope stability and foundation design.

Q4: What is the typical range for the saturated unit weight of soil?

For most common mineral soils (sands, clays, gravels), the saturated unit weight typically ranges from about 17 kN/m³ to 22 kN/m³ (approximately 105 to 140 lb/ft³). Organic soils or soils with very high void ratios might have values lower than this range.

Q5: My soil has a water content of 15%. Do I need to input this or the void ratio?

The calculator uses the Void Ratio (e). If you only have the Water Content (w) and the Specific Gravity (Gs), you can calculate the Void Ratio using the formula: e = w * Gs (ensure w is in decimal form, e.g., 15% = 0.15). Input the calculated 'e' value into the calculator.

Q6: How do I determine the Degree of Saturation (S) in the field?

Determining S accurately in the field can be challenging. It often involves measuring the water content (w) and knowing the specific gravity (Gs) and void ratio (e). The formula is: S = (w * Gs) / e. If the soil is visibly saturated (e.g., under water), S can be assumed as 100% (or 1.0).

Q7: Does the calculator account for soil compressibility?

This calculator calculates the saturated unit weight based on the given static properties (Gs, e, S). It does not directly model soil compressibility or how the void ratio might change under load. Compressibility is a separate, complex topic in soil mechanics, often analyzed through consolidation tests.

Q8: What is the Unit Weight of Water (γw)? Is it always 9.81 kN/m³?

The standard value for the unit weight of water (γw) at approximately 4°C is 9.81 kN/m³ (or 1000 kg/m³). At typical ambient temperatures (e.g., 20°C), it's slightly lower, around 9.79 kN/m³. For most geotechnical applications, 9.81 kN/m³ is a widely accepted and sufficiently accurate value. In some regions using Imperial units, 62.4 lb/ft³ is used. The calculator assumes 9.81 kN/m³.

© 2023 Your Engineering Tools. All rights reserved.

var unitWeightOfWater = 9.81; // kN/m³ – Assumed constant function validateInput(id, min, max, errorMessageId, helperText) { var input = document.getElementById(id); var errorElement = document.getElementById(errorMessageId); var value = parseFloat(input.value); // Clear previous error messages errorElement.textContent = "; errorElement.classList.remove('visible'); input.style.borderColor = "; // Reset border color if (isNaN(value)) { errorElement.textContent = 'Please enter a valid number.'; errorElement.classList.add('visible'); input.style.borderColor = '#dc3545'; return false; } if (id === 'waterContent') { // Water content is a percentage if (value 500) { // Allow high water content for organic soils, but cap reasonably errorElement.textContent = 'Water content is usually between 0% and 500%.'; errorElement.classList.add('visible'); input.style.borderColor = '#dc3545'; return false; } } else if (id === 'degreeOfSaturation') { if (value 100) { errorElement.textContent = 'Degree of Saturation must be between 0% and 100%.'; errorElement.classList.add('visible'); input.style.borderColor = '#dc3545'; return false; } } else { // Specific Gravity and Void Ratio if (value max) { errorElement.textContent = 'Value out of typical range (' + min + ' – ' + max + helperText + ').'; errorElement.classList.add('visible'); input.style.borderColor = '#dc3545'; return false; } } return true; } function calculateSaturatedUnitWeight() { var isValid = true; // Validate inputs isValid &= validateInput('specificGravity', 2.0, 3.0, 'specificGravityError', "); isValid &= validateInput('waterContent', 0, 500, 'waterContentError', '%'); // Water Content isValid &= validateInput('voidRatio', 0.01, 2.0, 'voidRatioError', "); // Void Ratio isValid &= validateInput('degreeOfSaturation', 0, 100, 'degreeOfSaturationError', '%'); // Degree of Saturation if (!isValid) { document.getElementById('results').style.display = 'none'; return; } var Gs = parseFloat(document.getElementById('specificGravity').value); var w_percent = parseFloat(document.getElementById('waterContent').value); var e = parseFloat(document.getElementById('voidRatio').value); var S_percent = parseFloat(document.getElementById('degreeOfSaturation').value); // Convert inputs to correct units/formats var w = w_percent / 100; // Water content as decimal var S = S_percent / 100; // Degree of saturation as decimal // Calculate Dry Unit Weight (gamma_d) first, as it's often an intermediate step // gamma_d = (Gs * gamma_w) / (1 + e) var dryUnitWeight = (Gs * unitWeightOfWater) / (1 + e); // Calculate Saturated Unit Weight (gamma_sat) // gamma_sat = ((Gs + e * S) / (1 + e)) * gamma_w var calculatedGammaSat = ((Gs + e * S) / (1 + e)) * unitWeightOfWater; // Ensure results are displayed correctly, handling potential floating point inaccuracies dryUnitWeight = parseFloat(dryUnitWeight.toFixed(2)); calculatedGammaSat = parseFloat(calculatedGammaSat.toFixed(2)); document.getElementById('unitWeightOfWater').textContent = unitWeightOfWater.toFixed(2); document.getElementById('dryUnitWeight').textContent = dryUnitWeight.toFixed(2); document.getElementById('calculatedGammaSat').textContent = calculatedGammaSat.toFixed(2); document.getElementById('saturatedUnitWeight').textContent = calculatedGammaSat.toFixed(2); // Primary result document.getElementById('results').style.display = 'block'; // Update table values dynamically updateTableValues(Gs, e, S_percent, calculatedGammaSat); updateChart(Gs, e, S_percent); } function updateTableValues(Gs, e, S_percent, calculatedGammaSat) { // Simplified calculation for table examples (assuming 100% saturation for consistency) var rowSandGammaSat = ((2.65 + 0.40) / (1 + 0.40)) * unitWeightOfWater; var rowClayGammaSat = ((2.70 + 0.80) / (1 + 0.80)) * unitWeightOfWater; var rowSiltGammaSat = ((2.68 + 1.20) / (1 + 1.20)) * unitWeightOfWater; var rowGravelGammaSat = ((2.75 + 0.30) / (1 + 0.30)) * unitWeightOfWater; document.getElementById('tableRowSand').textContent = rowSandGammaSat.toFixed(2); document.getElementById('tableRowClay').textContent = rowClayGammaSat.toFixed(2); document.getElementById('tableRowSilt').textContent = rowSiltGammaSat.toFixed(2); document.getElementById('tableRowGravel').textContent = rowGravelGammaSat.toFixed(2); } function updateChart(currentGs, currentE, currentSPercent) { var ctx = document.getElementById('soilChart').getContext('2d'); var chartData = { labels: [], datasets: [{ label: 'Saturated Unit Weight (kN/m³)', data: [], borderColor: 'var(–primary-color)', backgroundColor: 'rgba(0, 74, 153, 0.2)', fill: false, tension: 0.1 }, { label: 'Dry Unit Weight (kN/m³)', data: [], borderColor: 'var(–success-color)', backgroundColor: 'rgba(40, 167, 69, 0.2)', fill: false, tension: 0.1 }] }; // Generate data for void ratio from 0.1 to 2.0 (typical range) for (var i = 1; i <= 20; i++) { var e_val = i * 0.1; chartData.labels.push('e=' + e_val.toFixed(1)); // Calculate Dry Unit Weight var gamma_d_val = (currentGs * unitWeightOfWater) / (1 + e_val); chartData.datasets[1].data.push(parseFloat(gamma_d_val.toFixed(2))); // Calculate Saturated Unit Weight (assuming 100% saturation for this chart visualization) var gamma_sat_val = ((currentGs + e_val) / (1 + e_val)) * unitWeightOfWater; chartData.datasets[0].data.push(parseFloat(gamma_sat_val.toFixed(2))); } // Destroy existing chart if it exists if (window.soilChartInstance) { window.soilChartInstance.destroy(); } // Create the chart window.soilChartInstance = new Chart(ctx, { type: 'line', data: chartData, options: { responsive: true, maintainAspectRatio: false, scales: { x: { title: { display: true, text: 'Void Ratio (e)' } }, y: { title: { display: true, text: 'Unit Weight (kN/m³)' }, beginAtZero: true } }, plugins: { title: { display: true, text: 'Impact of Void Ratio on Unit Weights (for Gs=' + currentGs.toFixed(2) + ')' }, tooltip: { callbacks: { label: function(context) { var label = context.dataset.label || ''; if (label) { label += ': '; } if (context.parsed.y !== null) { label += context.parsed.y.toFixed(2); } return label; } } } } } }); } function copyResults() { var resultsDiv = document.getElementById('results'); if (resultsDiv.style.display === 'none') { alert('Please calculate the results first.'); return; } var primaryResult = document.getElementById('saturatedUnitWeight').textContent; var unitWater = document.getElementById('unitWeightOfWater').textContent; var dryUnitWeight = document.getElementById('dryUnitWeight').textContent; var calcGammaSat = document.getElementById('calculatedGammaSat').textContent; var assumptions = "Assumptions:\n"; assumptions += "- Unit Weight of Water (γw): " + unitWater + " kN/m³\n"; assumptions += "- Soil Specific Gravity (Gs): " + document.getElementById('specificGravity').value + "\n"; assumptions += "- Void Ratio (e): " + document.getElementById('voidRatio').value + "\n"; assumptions += "- Degree of Saturation (S): " + document.getElementById('degreeOfSaturation').value + "%\n"; if (document.getElementById('waterContent').value) { assumptions += "- Water Content (w): " + document.getElementById('waterContent').value + "%\n"; } var textToCopy = "Saturated Unit Weight Calculation Results:\n\n"; textToCopy += "Primary Result (Saturated Unit Weight – γsat): " + primaryResult + " kN/m³\n"; textToCopy += "Intermediate Value (Dry Unit Weight – γd): " + dryUnitWeight + " kN/m³\n"; textToCopy += "Intermediate Value (Calculated Saturated Unit Weight – γsat): " + calcGammaSat + " kN/m³\n\n"; textToCopy += assumptions; navigator.clipboard.writeText(textToCopy).then(function() { alert('Results copied to clipboard!'); }, function(err) { console.error('Could not copy text: ', err); alert('Failed to copy results. Please copy manually.'); }); } function resetCalculator() { document.getElementById('specificGravity').value = '2.65'; document.getElementById('waterContent').value = '20'; document.getElementById('voidRatio').value = '0.75'; document.getElementById('degreeOfSaturation').value = '100'; // Clear error messages document.getElementById('specificGravityError').textContent = ''; document.getElementById('specificGravityError').classList.remove('visible'); document.getElementById('waterContentError').textContent = ''; document.getElementById('waterContentError').classList.remove('visible'); document.getElementById('voidRatioError').textContent = ''; document.getElementById('voidRatioError').classList.remove('visible'); document.getElementById('degreeOfSaturationError').textContent = ''; document.getElementById('degreeOfSaturationError').classList.remove('visible'); document.getElementById('results').style.display = 'none'; if (window.soilChartInstance) { window.soilChartInstance.destroy(); // Destroy chart on reset } // Reset helper text borders document.getElementById('specificGravity').style.borderColor = ''; document.getElementById('waterContent').style.borderColor = ''; document.getElementById('voidRatio').style.borderColor = ''; document.getElementById('degreeOfSaturation').style.borderColor = ''; } // Initial calculation on page load (optional, but good for pre-filled defaults) document.addEventListener('DOMContentLoaded', function() { calculateSaturatedUnitWeight(); // Initialize chart with default values if needed or leave blank until first calculation var ctx = document.getElementById('soilChart').getContext('2d'); window.soilChartInstance = new Chart(ctx, { // Initialize without data initially type: 'line', data: { datasets: [] }, options: { responsive: true, maintainAspectRatio: false, plugins: { title: { display: true, text: 'Chart will appear after first calculation.' } } } }); // Destroy initial empty chart immediately if we want it to appear only after calculation if (window.soilChartInstance) { window.soilChartInstance.destroy(); } }); // Load Chart.js library if not already present if (typeof Chart === 'undefined') { var script = document.createElement('script'); script.src = 'https://cdn.jsdelivr.net/npm/chart.js'; document.head.appendChild(script); script.onload = function() { // Re-run initial calculation or chart update after script loads calculateSaturatedUnitWeight(); }; } else { // If Chart.js is already loaded, just run the initial calculation calculateSaturatedUnitWeight(); }

Leave a Comment