How to Calculate Saturated Unit Weight of Soil

Saturated Unit Weight of Soil Calculator & Guide :root { –primary-color: #004a99; –secondary-color: #007bff; –success-color: #28a745; –light-gray: #f8f9fa; –dark-gray: #343a40; –white: #ffffff; –border-color: #dee2e6; –shadow-color: rgba(0, 0, 0, 0.1); } body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background-color: var(–light-gray); color: var(–dark-gray); line-height: 1.6; margin: 0; padding: 0; } .container { max-width: 1000px; margin: 20px auto; padding: 20px; background-color: var(–white); border-radius: 8px; box-shadow: 0 2px 10px var(–shadow-color); } header { background-color: var(–primary-color); color: var(–white); padding: 20px 0; text-align: center; border-radius: 8px 8px 0 0; margin-bottom: 20px; } header h1 { margin: 0; font-size: 2.5em; } h1, h2, h3 { color: var(–primary-color); margin-bottom: 15px; } h1 { font-size: 2.2em; } h2 { font-size: 1.8em; border-bottom: 2px solid var(–secondary-color); padding-bottom: 5px; } h3 { font-size: 1.4em; margin-top: 25px; } .loan-calc-container { background-color: var(–white); padding: 30px; border-radius: 8px; box-shadow: 0 0 15px var(–shadow-color); margin-bottom: 30px; } .input-group { margin-bottom: 20px; text-align: left; } .input-group label { display: block; margin-bottom: 8px; font-weight: bold; color: var(–primary-color); } .input-group input[type="number"], .input-group select { width: calc(100% – 22px); padding: 12px; border: 1px solid var(–border-color); border-radius: 5px; font-size: 1em; box-sizing: border-box; /* Important for padding and border */ } .input-group input[type="number"]:focus, .input-group select:focus { border-color: var(–secondary-color); outline: none; box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25); } .input-group .helper-text { font-size: 0.85em; color: #6c757d; margin-top: 5px; display: block; } .input-group .error-message { color: #dc3545; font-size: 0.8em; margin-top: 5px; display: block; min-height: 1.2em; /* Prevent layout shifts */ } .button-group { display: flex; justify-content: space-between; margin-top: 25px; gap: 10px; } .button-group button { padding: 12px 20px; border: none; border-radius: 5px; font-size: 1em; cursor: pointer; transition: background-color 0.3s ease; flex-grow: 1; } .btn-calculate { background-color: var(–primary-color); color: var(–white); } .btn-calculate:hover { background-color: #003a70; } .btn-reset { background-color: #6c757d; color: var(–white); } .btn-reset:hover { background-color: #5a6268; } .btn-copy { background-color: var(–secondary-color); color: var(–white); } .btn-copy:hover { background-color: #0056b3; } #results-container { margin-top: 30px; background-color: var(–primary-color); color: var(–white); padding: 25px; border-radius: 8px; text-align: center; } #results-container h3 { color: var(–white); margin-bottom: 15px; font-size: 1.6em; } .main-result { font-size: 2.8em; font-weight: bold; color: #f0ad4e; /* A contrasting success/highlight color */ margin-bottom: 15px; padding: 10px; border-radius: 5px; background-color: rgba(255, 255, 255, 0.1); } .intermediate-results, .formula-explanation { margin-top: 20px; font-size: 0.95em; opacity: 0.9; } .intermediate-results p, .formula-explanation p { margin-bottom: 8px; } .intermediate-results span, .formula-explanation span { font-weight: bold; } .formula-explanation { background-color: rgba(255, 255, 255, 0.08); padding: 15px; border-radius: 5px; text-align: left; } table { width: 100%; border-collapse: collapse; margin-top: 25px; margin-bottom: 25px; box-shadow: 0 2px 5px var(–shadow-color); } thead { background-color: var(–primary-color); color: var(–white); } th, td { padding: 12px 15px; text-align: left; border: 1px solid var(–border-color); } tbody tr:nth-child(even) { background-color: var(–light-gray); } caption { font-size: 1.1em; font-weight: bold; margin-bottom: 10px; color: var(–dark-gray); text-align: left; } canvas { display: block; margin: 25px auto; background-color: var(–white); border-radius: 5px; box-shadow: 0 2px 5px var(–shadow-color); } .chart-legend { text-align: center; margin-top: 10px; font-size: 0.9em; color: #6c757d; } .chart-legend span { display: inline-block; margin: 0 10px; } .chart-legend span::before { content: "; display: inline-block; width: 12px; height: 12px; margin-right: 5px; border-radius: 3px; vertical-align: middle; } .legend-unit-weight::before { background-color: var(–primary-color); } .legend-data-points::before { background-color: var(–secondary-color); } .article-content { margin-top: 30px; background-color: var(–white); padding: 30px; border-radius: 8px; box-shadow: 0 0 15px var(–shadow-color); } .article-content h2 { margin-top: 30px; border-bottom-color: var(–secondary-color); } .article-content h3 { margin-top: 25px; color: var(–secondary-color); } .article-content p, .article-content ul, .article-content ol { margin-bottom: 15px; font-size: 1.05em; } .article-content ul, .article-content ol { padding-left: 20px; } .article-content li { margin-bottom: 8px; } .article-content code { background-color: var(–light-gray); padding: 2px 5px; border-radius: 3px; font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace; } .article-content a { color: var(–primary-color); text-decoration: none; font-weight: bold; } .article-content a:hover { text-decoration: underline; } .faq-item { margin-bottom: 15px; padding: 10px; border: 1px solid var(–border-color); border-radius: 5px; background-color: var(–light-gray); } .faq-item strong { color: var(–primary-color); cursor: pointer; display: block; padding: 5px 0; } .faq-item p { margin-top: 10px; margin-bottom: 0; font-size: 0.95em; color: #555; } #related-tools ul { list-style: none; padding: 0; } #related-tools li { margin-bottom: 15px; padding: 10px; border: 1px solid var(–border-color); border-radius: 5px; background-color: var(–light-gray); } #related-tools li:hover { background-color: var(–white); box-shadow: 0 1px 5px var(–shadow-color); } #related-tools h3 { margin-top: 0; border-bottom: none; padding-bottom: 0; color: var(–dark-gray); } #related-tools p { margin-bottom: 0; font-size: 0.9em; color: #6c757d; } #related-tools a { font-weight: bold; color: var(–primary-color); text-decoration: none; } #related-tools a:hover { text-decoration: underline; } footer { text-align: center; margin-top: 40px; padding: 20px; font-size: 0.9em; color: #6c757d; } .copy-message { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); background-color: rgba(0, 74, 153, 0.85); color: white; padding: 15px 25px; border-radius: 5px; font-size: 1.1em; z-index: 1000; opacity: 0; transition: opacity 0.5s ease-in-out; pointer-events: none; } .copy-message.show { opacity: 1; } /* Responsive adjustments */ @media (max-width: 768px) { .container { margin: 10px; padding: 15px; } header h1 { font-size: 2em; } h1 { font-size: 1.8em; } h2 { font-size: 1.5em; } .button-group { flex-direction: column; } .loan-calc-container, .article-content { padding: 20px; } #results-container { padding: 20px; } .main-result { font-size: 2.2em; } } @media (max-width: 480px) { header h1 { font-size: 1.7em; } h1 { font-size: 1.5em; } .main-result { font-size: 1.8em; } th, td { padding: 8px 10px; font-size: 0.9em; } canvas { max-width: 100%; } }

Saturated Unit Weight of Soil Calculator & Guide

Calculate Saturated Unit Weight of Soil

Enter the following soil properties to calculate its saturated unit weight. This is crucial for geotechnical engineering applications.

Typically in kN/m³ or lb/ft³.
Ratio of soil solids density to water density (unitless).
Expressed as a percentage (%).

Results

Specific Gravity of Soil Solids ($G_s$):

Water Content at Saturation ($w_s$):

Unit Weight of Water ($\gamma_w$):

Formula Used

The saturated unit weight ($\gamma_{sat}$) is calculated using the formula derived from the soil's properties:

$\gamma_{sat} = \frac{(G_s + e) \gamma_w}{1 + e}$, where $e = \frac{G_s w_s}{100}$ and $w_s$ is water content in decimal form.

We first determine the void ratio (e) using the specific gravity ($G_s$) and the water content at saturation ($w_s$), then substitute it into the saturated unit weight formula. The unit weight of water ($\gamma_w$) is assumed to be 9.81 kN/m³ or 62.4 lb/ft³ based on the input unit weight's likely units.

Saturated Unit Weight vs. Water Content

Saturated Unit Weight ($\gamma_{sat}$) Void Ratio ($e$)
Relationship between Saturated Unit Weight and Void Ratio across different soil conditions.

Soil Property Data

Property Symbol Value Unit
Dry Unit Weight $\gamma_d$ kN/m³ (assumed)
Specific Gravity of Solids $G_s$ Unitless
Water Content at Saturation $w_s$ %
Unit Weight of Water $\gamma_w$ kN/m³ (assumed)
Void Ratio $e$ Unitless
Saturated Unit Weight $\gamma_{sat}$ kN/m³ (assumed)
Summary of input and calculated soil properties. Units are assumed based on common geotechnical practice for dry unit weight.

What is Saturated Unit Weight of Soil?

The saturated unit weight of soil is a fundamental geotechnical property representing the weight of soil per unit volume when all its void spaces are completely filled with water. In simpler terms, it's the weight of a soil sample when it's fully submerged and holding as much water as possible within its structure. This property is distinct from the dry unit weight (the weight of solids per total volume) and the moist unit weight (the weight of solids and pore water per total volume under partially saturated conditions). Understanding how to calculate saturated unit weight of soil is crucial for civil engineers, geologists, and construction professionals.

Who Should Use It?

Professionals involved in:

  • Foundation design: Determining bearing capacity and settlement.
  • Slope stability analysis: Assessing the risk of landslides.
  • Earth retaining structure design: Calculating lateral earth pressures.
  • Pavement engineering: Understanding subgrade behavior.
  • Dam and levee construction: Ensuring structural integrity.
  • Site investigation and characterization: Classifying soil types and their behavior.

Anyone working with soil mechanics, especially where water content significantly influences soil behavior, will benefit from accurately calculating the saturated unit weight of soil.

Common Misconceptions

  • Confusing it with dry unit weight: Dry unit weight ($\gamma_d$) is the weight of soil solids only per unit volume, while saturated unit weight accounts for the weight of both solids and water filling the pores.
  • Assuming it's always higher than dry unit weight: This is generally true, as water adds weight. However, comparing it to moist unit weight requires careful consideration of the degree of saturation.
  • Overlooking the role of void ratio: The void ratio is a critical intermediate step. A higher void ratio generally leads to a higher saturated unit weight, assuming other factors remain constant.
  • Ignoring the unit weight of water: The density of water ($\gamma_w$) is a key component. Its value can vary slightly with temperature, but a standard value is typically used.

Saturated Unit Weight of Soil Formula and Mathematical Explanation

The calculation of the saturated unit weight of soil ($\gamma_{sat}$) is derived from fundamental principles of soil mechanics, relating the weights and volumes of soil solids and pore water. The process involves understanding the soil's solid components, its void spaces, and how water fills these voids.

The Core Formula

The primary formula for saturated unit weight is:

$\gamma_{sat} = \frac{G_s + e}{1 + e} \gamma_w$

Where:

  • $\gamma_{sat}$: Saturated Unit Weight of soil
  • $G_s$: Specific Gravity of Soil Solids (unitless)
  • $e$: Void Ratio (unitless)
  • $\gamma_w$: Unit Weight of Water (e.g., 9.81 kN/m³ or 62.4 lb/ft³)

Deriving the Void Ratio (e)

Often, the void ratio is not directly measured but calculated from other known properties. When a soil is saturated, the water content ($w_s$) is directly related to the void ratio and the specific gravity of solids. The relationship is:

$w_s = \frac{V_w \gamma_w}{V_s \gamma_s}$

Since $V_w = e V_s$ (volume of water equals void ratio times volume of solids) and $\gamma_s = G_s \gamma_w$ (specific gravity definition), we can substitute:

$w_s = \frac{e V_s \gamma_w}{V_s G_s \gamma_w} = \frac{e}{G_s}$

If $w_s$ is given as a percentage, it must first be converted to a decimal (divide by 100). So, the void ratio can be calculated as:

$e = G_s \times w_{s(decimal)}$

Where $w_{s(decimal)}$ is the water content at saturation expressed as a decimal (e.g., 30% = 0.30).

Putting it Together

By calculating the void ratio ($e$) first, we can then substitute it back into the main saturated unit weight formula:

$\gamma_{sat} = \frac{G_s + (G_s \times w_{s(decimal)})}{1 + (G_s \times w_{s(decimal)})} \gamma_w$

Variable Explanations and Typical Ranges

Variables in Saturated Unit Weight Calculation
Variable Meaning Unit Typical Range
$\gamma_{sat}$ Saturated Unit Weight kN/m³ or lb/ft³ 17 – 22 kN/m³ (common range for many soils)
$G_s$ Specific Gravity of Soil Solids Unitless 2.6 – 2.8 (typical for common minerals like quartz, feldspar)
$e$ Void Ratio Unitless 0.1 – 1.5 (can be higher for organic or loose soils)
$w_s$ Water Content at Saturation % or decimal 10% – 60% (highly variable, depends on void ratio and $G_s$)
$\gamma_w$ Unit Weight of Water kN/m³ or lb/ft³ 9.81 kN/m³ (fresh water at standard temp) or 62.4 lb/ft³ (fresh water at standard temp)

Practical Examples (Real-World Use Cases)

Example 1: Foundation Design for a Building

A civil engineer is designing a foundation for a new commercial building. The soil investigation reveals a medium-dense sand with the following properties:

  • Dry Unit Weight ($\gamma_d$): 17.0 kN/m³
  • Specific Gravity of Soil Solids ($G_s$): 2.67
  • Water Content at Saturation ($w_s$): 28%

Calculation Steps:

  1. Convert water content to decimal: $w_{s(decimal)} = 28 / 100 = 0.28$
  2. Calculate void ratio: $e = G_s \times w_{s(decimal)} = 2.67 \times 0.28 = 0.7476$
  3. Calculate saturated unit weight (assuming $\gamma_w = 9.81$ kN/m³):
    $\gamma_{sat} = \frac{G_s + e}{1 + e} \gamma_w = \frac{2.67 + 0.7476}{1 + 0.7476} \times 9.81 = \frac{3.4176}{1.7476} \times 9.81 \approx 1.9556 \times 9.81 \approx 19.18$ kN/m³

Interpretation: The saturated unit weight of this sand is approximately 19.18 kN/m³. This value is crucial for calculating the total stresses at various depths below the foundation, especially if the water table is high. Higher saturated unit weight contributes to higher total stress, which needs to be accounted for in bearing capacity and settlement calculations. This contrasts with the lower dry unit weight of 17.0 kN/m³, highlighting the significant increase in weight when the soil becomes saturated.

Example 2: Slope Stability Analysis for an Embankment

A geotechnical engineer is assessing the stability of an earth embankment. The fill material is a clayey silt with the following properties determined from lab tests:

  • Dry Unit Weight ($\gamma_d$): 15.5 kN/m³
  • Specific Gravity of Soil Solids ($G_s$): 2.70
  • Water Content at Saturation ($w_s$): 35%

Calculation Steps:

  1. Convert water content to decimal: $w_{s(decimal)} = 35 / 100 = 0.35$
  2. Calculate void ratio: $e = G_s \times w_{s(decimal)} = 2.70 \times 0.35 = 0.945$
  3. Calculate saturated unit weight (assuming $\gamma_w = 9.81$ kN/m³):
    $\gamma_{sat} = \frac{G_s + e}{1 + e} \gamma_w = \frac{2.70 + 0.945}{1 + 0.945} \times 9.81 = \frac{3.645}{1.945} \times 9.81 \approx 1.874 \times 9.81 \approx 18.38$ kN/m³

Interpretation: The saturated unit weight is approximately 18.38 kN/m³. For slope stability analysis, the effective stress is paramount. When the soil saturates, the pore water pressure increases, which reduces the effective stress and thus the shear strength of the soil. Knowing the saturated unit weight allows for the accurate calculation of total stresses and subsequently effective stresses under saturated conditions. This is critical for determining the factor of safety against slope failure. The calculation of how to calculate saturated unit weight of soil confirms that saturation significantly increases the soil's density compared to its dry state (15.5 kN/m³).

How to Use This Saturated Unit Weight Calculator

Our interactive calculator simplifies the process of determining the saturated unit weight of soil. Follow these simple steps:

  1. Input Dry Unit Weight ($\gamma_d$): Enter the measured dry unit weight of the soil sample. This is usually provided in units like kN/m³ or lb/ft³. The calculator assumes consistent units for water.
  2. Input Specific Gravity ($G_s$): Provide the specific gravity of the soil solids. This value is unitless and typically ranges between 2.6 and 2.8 for common minerals.
  3. Input Water Content at Saturation ($w_s$): Enter the water content percentage (%) at which the soil is fully saturated.
  4. Calculate: Click the "Calculate" button. The calculator will instantly display the primary result: the Saturated Unit Weight ($\gamma_{sat}$).

How to Read Results

  • Main Result ($\gamma_{sat}$): This is the highlighted, primary output, showing the calculated saturated unit weight of the soil in the assumed units (e.g., kN/m³).
  • Intermediate Values: Key values like the specific gravity ($G_s$), water content ($w_s$), and the unit weight of water ($\gamma_w$) used in the calculation are displayed for clarity. The calculated Void Ratio ($e$) is also shown.
  • Data Table: A table summarizes all input values and calculated outputs, reinforcing the data used and the results obtained.
  • Chart: Visualizes the relationship between the void ratio and the saturated unit weight, providing a graphical understanding of how these properties interact.

Decision-Making Guidance

Use the calculated saturated unit weight in conjunction with other soil parameters for:

  • Bearing Capacity Calculations: Higher saturated densities increase total stress.
  • Settlement Predictions: Understanding total weight is vital for predicting consolidation settlement.
  • Liquefaction Potential Analysis: Saturated conditions are a prerequisite for liquefaction.
  • Retaining Wall Design: Saturated soils exert different pressures on structures.

Always consult with a qualified geotechnical engineer for critical design decisions.

Key Factors That Affect Saturated Unit Weight Results

Several factors influence the calculated saturated unit weight of soil, and understanding them is key to accurate geotechnical analysis. The calculation of how to calculate saturated unit weight of soil is sensitive to these inputs:

  1. Void Ratio ($e$)

    This is arguably the most significant factor. The void ratio represents the volume of empty space between soil particles relative to the volume of the solids. Higher void ratios mean more space for water, thus increasing the total weight when saturated. For example, a loose, poorly graded sand will have a higher void ratio than a dense, well-graded gravel, leading to a higher saturated unit weight.

  2. Specific Gravity of Soil Solids ($G_s$)

    The specific gravity relates the density of the soil particles themselves to the density of water. Most common soil minerals (like quartz) have $G_s$ values around 2.65. However, soils containing heavier minerals or organic matter will have different $G_s$ values. A higher $G_s$ directly increases the saturated unit weight, as the solid particles themselves are denser.

  3. Unit Weight of Water ($\gamma_w$)

    While often treated as a constant (9.81 kN/m³ or 62.4 lb/ft³), the unit weight of water can vary slightly with temperature and salinity. In highly specialized or extreme temperature environments, this variation might become relevant. However, for most standard engineering applications, the assumed value is sufficient.

  4. Soil Particle Characteristics (Shape and Gradation)

    While not directly input variables in this simplified calculator, particle shape (e.g., rounded vs. angular) and gradation (particle size distribution) indirectly affect the void ratio. Angular particles tend to interlock less efficiently, potentially creating higher void ratios compared to rounded particles, all else being equal.

  5. Compaction Effort

    For engineered fills, the degree of compaction significantly impacts the void ratio and thus the saturated unit weight. A well-compacted soil will have a lower void ratio and higher dry unit weight compared to the same soil placed loosely. This will influence its saturated density as well.

  6. Presence of Fines (Silt and Clay)

    The proportion of fine particles (silt and clay) can influence the packing of coarser particles and the ability of the soil to hold water. Clays, in particular, can exhibit higher water contents due to their surface area and electrochemical forces, potentially affecting the overall void ratio and water retention characteristics.

Frequently Asked Questions (FAQ)

What is the difference between saturated unit weight and moist unit weight?

Moist unit weight is the weight of soil (solids + water) per unit volume under partially saturated conditions. Saturated unit weight is specifically when the voids are 100% filled with water, resulting in a higher density than typical moist conditions unless the soil is already saturated.

Can the saturated unit weight be less than the dry unit weight?

No. The dry unit weight considers only the weight of solids. Saturated unit weight includes the weight of solids plus the weight of water filling the voids. Water adds mass, so $\gamma_{sat}$ is always greater than $\gamma_d$ for any soil with a positive void ratio.

What happens if my soil is only partially saturated?

If the soil is partially saturated, you would use the moist unit weight calculation, which requires the degree of saturation (S) and the water content (w). The formula is more complex and depends on whether you know the void ratio or dry unit weight.

How does temperature affect the saturated unit weight?

Temperature primarily affects the unit weight of water ($\gamma_w$). Water is densest at about 4°C. At higher temperatures, water expands slightly, reducing its unit weight. While typically a minor effect in civil engineering, it can be considered in environments with significant temperature fluctuations.

Is the specific gravity of soil solids the same as the specific gravity of the soil mass?

No. Specific gravity of soil solids ($G_s$) refers only to the density of the solid particles. Specific gravity of the soil mass would need to account for the voids and water, making it dependent on the soil's density and saturation.

What is the typical range for the void ratio ($e$)?

The void ratio can vary widely. For dense granular soils, it might be as low as 0.2-0.4. For loose sands or normally consolidated clays, it can range from 0.5 to 1.0 or even higher for highly compressible clays or organic soils.

How accurate are the typical values for $G_s$ and $\gamma_w$?

The typical value for $G_s$ (around 2.65-2.8) is very accurate for most common mineral soils. $\gamma_w$ (9.81 kN/m³ or 62.4 lb/ft³) is standard for fresh water at typical ambient temperatures. Significant deviations would only occur with very unusual soil mineralogy or extreme environmental conditions.

Can I use this calculator if my input unit is in Imperial (lb/ft³)?

Yes. If you input your dry unit weight in lb/ft³, the calculator will use the corresponding standard value for the unit weight of water in Imperial units (62.4 lb/ft³) and provide the saturated unit weight in lb/ft³. Ensure all your inputs are in a consistent system (either metric or imperial).

© 2023 Your Company Name. All rights reserved.

Results Copied!
var unitWeightDryInput = document.getElementById('unitWeightDry'); var specificGravityInput = document.getElementById('specificGravity'); var waterContentSatInput = document.getElementById('waterContentSat'); var resultGsSpan = document.getElementById('resultGs'); var resultWsSpan = document.getElementById('resultWs'); var resultGwSpan = document.getElementById('resultGw'); var mainResultDiv = document.getElementById('main-result'); var tdUnitWeightDry = document.getElementById('tdUnitWeightDry'); var tdSpecificGravity = document.getElementById('tdSpecificGravity'); var tdWaterContentSat = document.getElementById('tdWaterContentSat'); var tdUnitWeightWater = document.getElementById('tdUnitWeightWater'); var tdVoidRatio = document.getElementById('tdVoidRatio'); var tdSaturatedUnitWeight = document.getElementById('tdSaturatedUnitWeight'); var chart = null; var chartContext = null; var chartCanvas = document.getElementById('saturatedWeightChart'); // Default Values (Sensible Defaults) var defaultUnitWeightDry = 16.5; // kN/m³ var defaultSpecificGravity = 2.65; var defaultWaterContentSat = 30; // % function initializeDefaults() { unitWeightDryInput.value = defaultUnitWeightDry; specificGravityInput.value = defaultSpecificGravity; waterContentSatInput.value = defaultWaterContentSat; } function getUnitWeightWater() { var unitWeightDryVal = parseFloat(unitWeightDryInput.value); if (isNaN(unitWeightDryVal) || unitWeightDryVal 20) { // Heuristic threshold, e.g., 20 kN/m³ is ~125 lb/ft³ return 62.4; // lb/ft³ } else { return 9.81; // kN/m³ } } function updateTableUnits(gammaW) { var unitText = (gammaW === 62.4) ? "lb/ft³" : "kN/m³"; document.querySelector('#dataTableBody tr:nth-child(1) td:last-child').textContent = unitText; // Dry Unit Weight document.querySelector('#dataTableBody tr:nth-child(4) td:last-child').textContent = unitText; // Unit Weight of Water document.querySelector('#dataTableBody tr:nth-child(6) td:last-child').textContent = unitText; // Saturated Unit Weight } function calculateSaturatedUnitWeight() { // Clear previous errors document.getElementById('unitWeightDryError').textContent = "; document.getElementById('specificGravityError').textContent = "; document.getElementById('waterContentSatError').textContent = "; var unitWeightDry = parseFloat(unitWeightDryInput.value); var specificGravity = parseFloat(specificGravityInput.value); var waterContentSatPercent = parseFloat(waterContentSatInput.value); var isValid = true; if (isNaN(unitWeightDry) || unitWeightDry <= 0) { document.getElementById('unitWeightDryError').textContent = 'Please enter a valid dry unit weight (must be positive).'; isValid = false; } if (isNaN(specificGravity) || specificGravity 1 document.getElementById('specificGravityError').textContent = 'Please enter a valid specific gravity (must be >= 1).'; isValid = false; } if (isNaN(waterContentSatPercent) || waterContentSatPercent 100) { document.getElementById('waterContentSatError').textContent = 'Water content must be between 0% and 100%.'; isValid = false; } if (!isValid) { mainResultDiv.textContent = '–'; resultGsSpan.textContent = '–'; resultWsSpan.textContent = '–'; resultGwSpan.textContent = '–'; tdVoidRatio.textContent = '–'; tdSaturatedUnitWeight.textContent = '–'; updateTableData('–', '–', '–', '–', '–', '–'); updateChart([], []); // Clear chart return; } var waterContentSatDecimal = waterContentSatPercent / 100; var gammaW = getUnitWeightWater(); updateTableUnits(gammaW); // Update units in the table // Calculate void ratio (e) var voidRatio = specificGravity * waterContentSatDecimal; // Calculate saturated unit weight (gamma_sat) var saturatedUnitWeight = ((specificGravity + voidRatio) / (1 + voidRatio)) * gammaW; // Display Results resultGsSpan.textContent = specificGravity.toFixed(2); resultWsSpan.textContent = waterContentSatPercent.toFixed(1) + '%'; resultGwSpan.textContent = gammaW.toFixed(2); mainResultDiv.textContent = saturatedUnitWeight.toFixed(2); // Update intermediate results and table tdVoidRatio.textContent = voidRatio.toFixed(3); tdSaturatedUnitWeight.textContent = saturatedUnitWeight.toFixed(2); updateTableData(unitWeightDry.toFixed(2), specificGravity.toFixed(2), waterContentSatPercent.toFixed(1), gammaW.toFixed(2), voidRatio.toFixed(3), saturatedUnitWeight.toFixed(2)); // Update chart data updateChartData(voidRatio, saturatedUnitWeight, specificGravity); } function updateTableData(dryW, specG, waterC, waterGamma, voidR, satW) { tdUnitWeightDry.textContent = dryW; tdSpecificGravity.textContent = specG; tdWaterContentSat.textContent = waterC; tdUnitWeightWater.textContent = waterGamma; tdVoidRatio.textContent = voidR; tdSaturatedUnitWeight.textContent = satW; } function resetCalculator() { initializeDefaults(); calculateSaturatedUnitWeight(); // Recalculate with defaults clearMessages(); } function copyResults() { var unitWeightDryVal = unitWeightDryInput.value; var specificGravityVal = specificGravityInput.value; var waterContentSatVal = waterContentSatInput.value; var gammaW = getUnitWeightWater(); var voidRatio = parseFloat(tdVoidRatio.textContent); var saturatedUnitWeight = parseFloat(mainResultDiv.textContent); var copyText = "— Saturated Unit Weight of Soil Calculation —\n\n"; copyText += "Inputs:\n"; copyText += "- Dry Unit Weight ($\gamma_d$): " + unitWeightDryVal + " (assumed units)\n"; copyText += "- Specific Gravity ($G_s$): " + specificGravityVal + "\n"; copyText += "- Water Content at Saturation ($w_s$): " + waterContentSatVal + "%\n\n"; copyText += "Calculated Values:\n"; copyText += "- Unit Weight of Water ($\gamma_w$): " + gammaW.toFixed(2) + (gammaW === 62.4 ? " lb/ft³" : " kN/m³") + "\n"; copyText += "- Void Ratio ($e$): " + (isNaN(voidRatio) ? "–" : voidRatio.toFixed(3)) + "\n"; copyText += "- Saturated Unit Weight ($\gamma_{sat}$): " + (isNaN(saturatedUnitWeight) ? "–" : saturatedUnitWeight.toFixed(2)) + (gammaW === 62.4 ? " lb/ft³" : " kN/m³") + "\n\n"; copyText += "Formula Used:\n"; copyText += "$\gamma_{sat} = \frac{(G_s + e) \gamma_w}{1 + e}$ where $e = G_s \times w_{s(decimal)}$\n"; navigator.clipboard.writeText(copyText).then(function() { var messageElement = document.getElementById('copyMessage'); messageElement.classList.add('show'); setTimeout(function() { messageElement.classList.remove('show'); }, 2000); }).catch(function(err) { console.error('Failed to copy text: ', err); alert('Failed to copy results. Please copy manually.'); }); } function clearMessages() { document.getElementById('unitWeightDryError').textContent = "; document.getElementById('specificGravityError').textContent = "; document.getElementById('waterContentSatError').textContent = "; } // Charting Functions function initializeChart() { chartCanvas = document.getElementById('saturatedWeightChart'); if (chartCanvas) { chartContext = chartCanvas.getContext('2d'); chart = new Chart(chartContext, { type: 'line', data: { labels: [], // Void ratio values datasets: [{ label: 'Saturated Unit Weight (kN/m³)', data: [], // Saturated unit weight values borderColor: 'var(–primary-color)', backgroundColor: 'rgba(0, 74, 153, 0.1)', fill: false, tension: 0.1 }, { label: 'Void Ratio', data: [], // Void ratio values borderColor: 'var(–secondary-color)', backgroundColor: 'rgba(0, 123, 255, 0.1)', fill: false, tension: 0.1, yAxisID: 'y-axis-ratio' // Use a secondary y-axis for void ratio }] }, options: { responsive: true, maintainAspectRatio: false, scales: { x: { title: { display: true, text: 'Void Ratio (e)', color: 'var(–primary-color)' } }, y: { title: { display: true, text: 'Saturated Unit Weight (kN/m³)', color: 'var(–primary-color)' }, beginAtZero: true }, 'y-axis-ratio': { // Configuration for the secondary y-axis title: { display: true, text: 'Void Ratio (e)', color: 'var(–secondary-color)' }, position: 'right', beginAtZero: true, grid: { drawOnChartArea: false, // only want the grid lines for one axis to show }, ticks: { callback: function(value, index, values) { // Format to 3 decimal places for void ratio return value.toFixed(3); } } } }, plugins: { legend: { display: true, position: 'top', }, title: { display: true, text: 'Saturated Unit Weight vs. Void Ratio', color: 'var(–primary-color)', font: { size: 16 } } } } }); } else { console.error("Canvas element not found."); } } function updateChartData(currentVoidRatio, currentSatWeight, currentGs) { if (!chart) { console.error("Chart not initialized."); return; } var currentGammaW = getUnitWeightWater(); var unitText = (currentGammaW === 62.4) ? " (lb/ft³)" : " (kN/m³)"; chart.data.datasets[0].label = 'Saturated Unit Weight' + unitText; // Update label with units var numPoints = 10; // Number of data points to generate for the line var eValues = []; var satWeightValues = []; // Generate data points around the current void ratio var minERatio = Math.max(0, currentVoidRatio – 0.5); // Adjust range as needed var maxERatio = currentVoidRatio + 0.5; // Adjust range as needed if (minERatio === 0 && maxERatio === 0.5) maxERatio = 1.0; // Ensure some range if current is 0 var step = (maxERatio – minERatio) / (numPoints – 1); for (var i = 0; i < numPoints; i++) { var e = minERatio + i * step; if (e < 0) e = 0; // Ensure void ratio is not negative // Recalculate saturated weight based on the generated e, constant Gs and GammaW var calculatedSatWeight = ((currentGs + e) / (1 + e)) * currentGammaW; eValues.push(parseFloat(e.toFixed(3))); // Round for label clarity satWeightValues.push(parseFloat(calculatedSatWeight.toFixed(2))); } // Ensure current calculated point is included precisely var currentPointIndex = eValues.indexOf(parseFloat(currentVoidRatio.toFixed(3))); if (currentPointIndex === -1) { eValues.push(parseFloat(currentVoidRatio.toFixed(3))); satWeightValues.push(parseFloat(currentSatWeight.toFixed(2))); // Sort arrays by void ratio to maintain line continuity var combined = []; for (var i = 0; i < eValues.length; i++) { combined.push({e: eValues[i], satW: satWeightValues[i]}); } combined.sort(function(a, b) { return a.e – b.e; }); eValues = combined.map(function(item) { return item.e; }); satWeightValues = combined.map(function(item) { return item.satW; }); } else { // Update the existing point if it matches satWeightValues[currentPointIndex] = parseFloat(currentSatWeight.toFixed(2)); } chart.data.labels = eValues; chart.data.datasets[0].data = satWeightValues; // Saturated Unit Weight data chart.data.datasets[1].data = eValues; // Void Ratio data // Update chart axis titles if units changed chart.options.scales.y.title.text = 'Saturated Unit Weight' + unitText; chart.update(); } // Initialize calculator state and chart on load document.addEventListener('DOMContentLoaded', function() { initializeDefaults(); calculateSaturatedUnitWeight(); initializeChart(); // Trigger initial chart update with default values var unitWeightDryVal = parseFloat(unitWeightDryInput.value); var specificGravityVal = parseFloat(specificGravityInput.value); var waterContentSatPercentVal = parseFloat(waterContentSatInput.value); var waterContentSatDecimalVal = waterContentSatPercentVal / 100; var voidRatioVal = specificGravityVal * waterContentSatDecimalVal; var gammaWVal = getUnitWeightWater(); var satWeightVal = ((specificGravityVal + voidRatioVal) / (1 + voidRatioVal)) * gammaWVal; updateChartData(voidRatioVal, satWeightVal, specificGravityVal); // Add event listeners for real-time updates (optional, but good for UX) unitWeightDryInput.addEventListener('input', calculateSaturatedUnitWeight); specificGravityInput.addEventListener('input', calculateSaturatedUnitWeight); waterContentSatInput.addEventListener('input', calculateSaturatedUnitWeight); // Add event listener for unit weight change impacting gammaW and chart units unitWeightDryInput.addEventListener('input', function() { var gammaW = getUnitWeightWater(); var currentGs = parseFloat(specificGravityInput.value) || defaultSpecificGravity; var currentWsPercent = parseFloat(waterContentSatInput.value) || defaultWaterContentSat; var currentWsDecimal = currentWsPercent / 100; var currentE = currentGs * currentWsDecimal; var currentSatW = ((currentGs + currentE) / (1 + currentE)) * gammaW; calculateSaturatedUnitWeight(); // Recalculate main values updateChartData(currentE, currentSatW, currentGs); // Update chart with new units }); });

Leave a Comment