Calculating Wet Unit Weight of Soil

Soil Wet Unit Weight 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; padding-bottom: 50px; } .container { width: 100%; max-width: 960px; margin: 20px auto; padding: 20px; background-color: #fff; box-shadow: 0 2px 10px var(–shadow-color); border-radius: 8px; display: flex; flex-direction: column; align-items: center; } header { width: 100%; background-color: var(–primary-color); color: #fff; padding: 20px 0; text-align: center; margin-bottom: 30px; border-radius: 8px 8px 0 0; } header h1 { margin: 0; font-size: 2.5em; font-weight: 700; } .loan-calc-container { width: 100%; margin-bottom: 40px; padding: 30px; background-color: #f0f2f5; border-radius: 8px; box-shadow: inset 0 1px 3px var(–shadow-color); } .input-group { margin-bottom: 20px; width: 100%; text-align: left; } .input-group label { display: block; font-weight: 600; margin-bottom: 8px; 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; transition: border-color 0.3s ease; } .input-group input[type="number"]: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; display: block; } .input-group .error-message { color: red; font-size: 0.8em; margin-top: 5px; display: none; /* Hidden by default */ min-height: 1.2em; } .button-group { display: flex; justify-content: space-between; margin-top: 30px; gap: 10px; } .btn { padding: 12px 25px; border: none; border-radius: 5px; cursor: pointer; font-size: 1em; font-weight: 600; 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); } .results-section { margin-top: 30px; padding: 25px; background-color: #e9ecef; border-radius: 8px; width: 100%; box-sizing: border-box; } .results-section h3 { margin-top: 0; color: var(–primary-color); text-align: center; font-size: 1.8em; } .primary-result { font-size: 2.2em; font-weight: 700; color: var(–success-color); text-align: center; margin: 15px 0; padding: 15px; background-color: #d4edda; border-radius: 5px; border: 1px solid var(–success-color); } .intermediate-results { display: flex; flex-wrap: wrap; justify-content: space-around; gap: 15px; margin-top: 20px; padding: 15px; background-color: #ffffff; border-radius: 5px; border: 1px solid #e0e0e0; } .intermediate-result-item { text-align: center; padding: 10px; flex: 1 1 0; min-width: 150px; } .intermediate-result-item .label { font-size: 0.9em; color: #555; display: block; margin-bottom: 5px; } .intermediate-result-item .value { font-size: 1.4em; font-weight: 600; color: var(–primary-color); } .formula-explanation { margin-top: 20px; font-size: 0.95em; color: #555; border-top: 1px dashed #ccc; padding-top: 15px; } .copy-button { display: block; width: fit-content; margin: 20px auto 0 auto; background-color: var(–primary-color); color: white; padding: 10px 20px; border-radius: 5px; cursor: pointer; font-size: 0.9em; transition: background-color 0.3s ease; } .copy-button:hover { background-color: #003366; } .canvas-chart-container { width: 100%; margin-top: 30px; padding: 20px; background-color: #fff; border-radius: 8px; box-shadow: 0 2px 5px var(–shadow-color); } .canvas-chart-container h4 { text-align: center; margin-top: 0; color: var(–primary-color); font-size: 1.6em; } #soilChart { width: 100%; max-width: 100%; height: 300px; } .chart-caption { text-align: center; font-size: 0.9em; color: #666; margin-top: 10px; display: block; } table { width: 100%; border-collapse: collapse; margin-top: 20px; margin-bottom: 30px; } th, td { border: 1px solid #ddd; padding: 10px; text-align: center; } th { background-color: var(–primary-color); color: white; font-weight: 600; } tr:nth-child(even) { background-color: #f2f2f2; } .table-caption { text-align: center; font-size: 1em; color: #555; margin-bottom: 15px; font-weight: 600; display: block; } .article-section { width: 100%; margin-top: 40px; padding: 30px; background-color: #fff; border-radius: 8px; box-shadow: 0 2px 10px var(–shadow-color); } .article-section h2 { color: var(–primary-color); font-size: 2em; margin-top: 0; border-bottom: 2px solid var(–primary-color); padding-bottom: 10px; margin-bottom: 20px; } .article-section h3 { color: var(–primary-color); font-size: 1.6em; margin-top: 30px; margin-bottom: 15px; } .article-section p, .article-section ul, .article-section ol { margin-bottom: 20px; font-size: 1.05em; } .article-section li { margin-bottom: 10px; } .article-section a { color: var(–primary-color); text-decoration: none; font-weight: 500; } .article-section a:hover { text-decoration: underline; } .faq-list .faq-item { margin-bottom: 25px; border-left: 3px solid var(–primary-color); padding-left: 15px; } .faq-list .faq-item h4 { margin: 0 0 8px 0; font-size: 1.2em; color: var(–primary-color); font-weight: 600; } .related-tools { margin-top: 30px; padding: 25px; background-color: #e9ecef; border-radius: 8px; width: 100%; box-sizing: border-box; } .related-tools h3 { text-align: center; color: var(–primary-color); margin-top: 0; font-size: 1.8em; } .related-tools ul { list-style: none; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 15px; } .related-tools li { background-color: #fff; padding: 15px; border-radius: 5px; box-shadow: 0 1px 3px var(–shadow-color); text-align: center; flex-basis: 200px; } .related-tools a { font-weight: 600; color: var(–primary-color); text-decoration: none; } .related-tools a:hover { text-decoration: underline; } .related-tools p { font-size: 0.85em; color: #555; margin-top: 5px; } footer { text-align: center; margin-top: 40px; font-size: 0.9em; color: #777; width: 100%; padding: 20px; background-color: #e9ecef; border-radius: 8px; } @media (max-width: 768px) { .container { margin: 10px; padding: 15px; } header h1 { font-size: 2em; } .btn { padding: 10px 15px; font-size: 0.9em; } .primary-result { font-size: 1.8em; } .intermediate-result-item .value { font-size: 1.2em; } .results-section, .article-section, .canvas-chart-container { padding: 20px 15px; } .article-section h2 { font-size: 1.8em; } .article-section h3 { font-size: 1.4em; } .button-group { flex-direction: column; align-items: center; } .btn { width: 80%; } }

Soil Wet Unit Weight Calculator

Determine the density of soil under saturated conditions.

Input Soil Properties

Enter the dry unit weight of the soil.
Enter the water content as a percentage (e.g., 25 for 25%).
Enter the specific gravity of soil solids.
Enter the degree of saturation as a percentage (e.g., 100 for saturated).

Calculation Results

Void Ratio (e)
Moisture Unit Weight (γw)
Degree of Saturation Check
Formula Used:
The wet unit weight (γw) is calculated using the relationship between dry unit weight (γd), water content (w), and the unit weight of water (γw). For saturated conditions, or where degree of saturation is known, specific formulas are applied.

Commonly: γw = γd * (1 + w) (for total unit weight, often used interchangeably with wet unit weight)
Or derived from void ratio, specific gravity, and saturation: γw = [(Gs + Se) / (1 + e)] * γw_unit where Gs is specific gravity, S is degree of saturation, e is void ratio, and γw_unit is the unit weight of water.

Wet Unit Weight vs. Water Content

Comparison of Wet Unit Weight at varying water content levels, assuming constant dry unit weight and specific gravity.
Input Variable Unit Typical Range Description
Dry Unit Weight (γd) kN/m³ or lb/ft³ 14 – 22 kN/m³ (90 – 140 lb/ft³) Weight of dry soil solids per unit volume.
Water Content (w) % 0 – 60% Ratio of weight of water to weight of solids, expressed as a percentage.
Specific Gravity (Gs) Unitless 2.5 – 2.9 Ratio of the density of soil solids to the density of water.
Degree of Saturation (S) % 0 – 100% Ratio of the volume of water to the volume of voids, expressed as a percentage.
Wet Unit Weight (γw) kN/m³ or lb/ft³ 16 – 24 kN/m³ (100 – 150 lb/ft³) Total weight of soil (solids + water) per unit volume.

What is Soil Wet Unit Weight?

Soil wet unit weight, often denoted as γw (gamma-w), is a fundamental geotechnical property that quantifies the weight of soil per unit volume when it is in a wet or saturated state. It represents the combined weight of soil solids and any water present within the soil's pore spaces, divided by the total volume of the soil mass. Understanding the wet unit weight of soil is crucial for various engineering applications, particularly in civil engineering for foundation design, slope stability analysis, earthwork calculations, and pavement design. It helps engineers predict how soil will behave under load and environmental conditions.

Who should use it? Geotechnical engineers, civil engineers, construction managers, surveyors, environmental scientists, and researchers involved in soil mechanics, foundation engineering, and construction projects frequently utilize the concept of soil wet unit weight. It's a key parameter for material estimation, bearing capacity calculations, and assessing the impact of groundwater on soil structures.

Common Misconceptions: A common misconception is that "wet unit weight" is always higher than "dry unit weight." While generally true, the exact relationship depends on the soil's degree of saturation. Another misconception is that it's a fixed value; in reality, the wet unit weight of soil can vary significantly based on its composition, density, moisture content, and compaction level. It's also sometimes confused with bulk unit weight or total unit weight, though in common practice, they are often used interchangeably when referring to soil in its natural or field condition with moisture present.

Soil Wet Unit Weight Formula and Mathematical Explanation

Calculating the wet unit weight of soil involves understanding its components: soil solids, water, and voids. The primary formula for wet unit weight (often referred to as total unit weight in this context) is derived from the basic definition of unit weight:

γw = (W_s + W_w) / V_t

Where:

  • γw = Wet unit weight of soil
  • W_s = Weight of soil solids
  • W_w = Weight of water
  • V_t = Total volume of the soil mass

This definition can be expressed in terms of more commonly measured or derived soil properties. A very practical form, especially when the dry unit weight (γd) and water content (w) are known, is:

γw = γd * (1 + w)

Here:

  • γd = Dry unit weight (weight of solids / total volume)
  • w = Water content (weight of water / weight of solids)

The relationship can also be derived using the void ratio (e), specific gravity of solids (Gs), degree of saturation (S), and the unit weight of water (γw_unit):

First, we need the void ratio (e):

e = (Gs * γw_unit / γd) – 1

Then, the wet unit weight can be expressed as:

γw = [(Gs + S * e) / (1 + e)] * γw_unit

This formula is particularly useful when dealing with partially saturated soils or when detailed information about voids is available.

Variable Explanations

Let's break down the variables involved in calculating soil wet unit weight:

Variable Meaning Unit Typical Range
γw (Wet Unit Weight) Total weight of soil (solids + water) per unit volume. kN/m³ or lb/ft³ 16 – 24 kN/m³ (100 – 150 lb/ft³)
γd (Dry Unit Weight) Weight of soil solids per unit volume. kN/m³ or lb/ft³ 14 – 22 kN/m³ (90 – 140 lb/ft³)
w (Water Content) Ratio of weight of water to weight of soil solids. % 0 – 60%
Gs (Specific Gravity of Solids) Ratio of density of soil solids to density of water. Unitless 2.5 – 2.9 (common minerals)
S (Degree of Saturation) Ratio of volume of water to volume of voids. % 0 – 100%
e (Void Ratio) Ratio of volume of voids to volume of solids. Unitless 0.1 – 1.5+ (depends on soil type and density)
γw_unit (Unit Weight of Water) Weight of water per unit volume. kN/m³ or lb/ft³ 9.81 kN/m³ (62.4 lb/ft³) at standard conditions
V_t (Total Volume) Total volume occupied by soil (solids + voids). m³ or ft³ Variable

Practical Examples (Real-World Use Cases)

Understanding how soil wet unit weight is applied in practice is key. Here are two examples:

Example 1: Foundation Design for a Building

A civil engineer is designing the foundation for a small commercial building. The soil investigation report indicates a typical dry unit weight (γd) of 18.5 kN/m³ and an average water content (w) of 22%. The soil is expected to remain consistently moist due to shallow groundwater. The engineer needs to calculate the wet unit weight to estimate the soil's contribution to the foundation's bearing capacity and overall stability.

Inputs:

  • Dry Unit Weight (γd): 18.5 kN/m³
  • Water Content (w): 22% (or 0.22)

Calculation: Using the formula γw = γd * (1 + w)

γw = 18.5 kN/m³ * (1 + 0.22)

γw = 18.5 kN/m³ * 1.22

Result: Wet Unit Weight (γw) = 22.57 kN/m³

Interpretation: The wet unit weight of 22.57 kN/m³ indicates that each cubic meter of this moist soil weighs approximately 22.57 kilonewtons. This value will be used in bearing capacity calculations, considering the increased weight due to moisture, which affects the pressure exerted on underlying soil layers and the overall structural integrity. This is significantly higher than the dry unit weight, highlighting the importance of accounting for moisture.

Example 2: Slope Stability Analysis of an Embankment

A geotechnical engineer is analyzing the stability of a proposed highway embankment. Soil samples from the site show a dry unit weight (γd) of 16.0 kN/m³ and a specific gravity (Gs) of 2.70. During construction, the soil is compacted to achieve a degree of saturation (S) of 85%, and the final condition is expected to be saturated (S=100%). For the worst-case scenario analysis, the engineer assumes full saturation.

Inputs:

  • Dry Unit Weight (γd): 16.0 kN/m³
  • Specific Gravity (Gs): 2.70
  • Degree of Saturation (S): 100% (or 1.00) for saturated analysis
  • Unit Weight of Water (γw_unit): 9.81 kN/m³

Calculations:

1. Calculate Void Ratio (e): e = (Gs * γw_unit / γd) – 1 e = (2.70 * 9.81 kN/m³ / 16.0 kN/m³) – 1 e = (26.487 / 16.0) – 1 e = 1.655 – 1 e = 0.655

2. Calculate Wet Unit Weight (γw): γw = [(Gs + S * e) / (1 + e)] * γw_unit γw = [(2.70 + 1.00 * 0.655) / (1 + 0.655)] * 9.81 kN/m³ γw = [3.355 / 1.655] * 9.81 kN/m³ γw = 2.027 * 9.81 kN/m³

Result: Wet Unit Weight (γw) = 19.88 kN/m³

Interpretation: In a fully saturated state, the soil's wet unit weight is approximately 19.88 kN/m³. This value is critical for determining the driving forces in slope stability calculations (e.g., the weight of the soil mass contributing to potential slides). A higher wet unit weight increases the driving forces, potentially reducing the factor of safety. This example demonstrates how to calculate wet unit weight using more detailed soil parameters when simple water content isn't the only variable or when saturation is a key factor.

How to Use This Soil Wet Unit Weight Calculator

Our free online calculator makes determining the wet unit weight of soil quick and easy. Follow these simple steps:

  1. Gather Your Data: Collect the necessary soil properties from your lab tests or site investigation report. These typically include the dry unit weight (γd), water content (w), specific gravity (Gs), and degree of saturation (S).
  2. Enter Input Values:
    • Input the Dry Unit Weight in your preferred units (kN/m³ or lb/ft³).
    • Enter the Water Content as a percentage (e.g., enter 25 for 25%).
    • Input the Specific Gravity (Gs). This is a unitless property.
    • Enter the Degree of Saturation as a percentage (e.g., enter 100 for fully saturated).
    Ensure you enter consistent units for dry unit weight. The calculator will use the unit you input for the results.
  3. Perform Calculations: Click the "Calculate Wet Unit Weight" button. The calculator will automatically compute the primary result and key intermediate values.
  4. Review Results:
    • The main result displayed prominently is the Wet Unit Weight (γw) in the units you specified.
    • Intermediate values like Void Ratio (e) and Moisture Unit Weight (γw – unit weight of water) are also shown, providing deeper insight into the soil's characteristics.
    • A Degree of Saturation Check helps verify consistency.
    • The formula used is explained for clarity.
  5. Utilize Additional Features:
    • Copy Results: Click "Copy Results" to easily transfer all calculated values and key assumptions to your reports or notes.
    • Reset: Use the "Reset" button to clear all fields and start over with new calculations.
    • Chart: Observe the dynamic chart showing how wet unit weight changes with water content under typical assumptions.

Decision-Making Guidance: The calculated wet unit weight is a critical parameter. A higher wet unit weight generally means denser, heavier soil, which can increase bearing capacity but also lateral earth pressure and settlement potential. Conversely, lower wet unit weight might indicate looser soil with lower strength. Use these results in conjunction with other soil properties and engineering codes to make informed decisions about foundation design, slope stability, and earthwork.

Key Factors That Affect Soil Wet Unit Weight

Several factors influence the wet unit weight of soil. Understanding these helps in interpreting calculation results and predicting soil behavior:

  • Water Content: This is the most direct factor. As water content increases, the total weight of the soil mass increases, thus increasing the wet unit weight, assuming the volume remains constant. This is clearly seen in the formula γw = γd * (1 + w).
  • Dry Unit Weight (Compaction): The dry unit weight itself is heavily influenced by the soil's density and compaction level. Densely compacted soils have a higher dry unit weight. Since wet unit weight is often derived from dry unit weight, variations in compaction directly impact the final wet unit weight calculation.
  • Void Ratio and Porosity: Soils with higher void ratios (more empty space) can hold more water. This affects how the soil saturates and influences the wet unit weight. A lower void ratio generally leads to a higher dry unit weight and potentially a higher wet unit weight if saturated.
  • Specific Gravity of Soil Solids (Gs): Soils composed of denser minerals (higher Gs) will naturally have higher unit weights, both dry and wet, assuming similar void ratios and water content. For example, soils with a high proportion of quartz or metallic oxides will have higher Gs than those rich in organic matter.
  • Degree of Saturation: This determines how much of the void space is filled with water. A soil that is only partially saturated will have a lower wet unit weight than the same soil when fully saturated, as there is still air present in the pores.
  • Soil Type and Particle Size Distribution: Different soil types (e.g., clay, sand, gravel) have inherent differences in particle density, shape, and how they pack together, affecting their void ratios and overall unit weights. Well-graded soils often achieve higher densities (and thus higher unit weights) than poorly graded ones.
  • Particle Shape and Mineralogy: Angular particles tend to interlock more than rounded particles, potentially leading to higher densities. The mineral composition of the soil solids determines the specific gravity (Gs), a critical factor in unit weight calculations.
  • Presence of Organic Matter: Organic soils are typically less dense than mineral soils due to the lower specific gravity of organic constituents, resulting in lower unit weights.

Frequently Asked Questions (FAQ)

What is the difference between wet unit weight and dry unit weight?

Dry unit weight (γd) refers to the weight of soil solids per unit total volume. Wet unit weight (γw) includes the weight of both soil solids and the water present in the pore spaces, also per unit total volume. Wet unit weight is generally higher than dry unit weight due to the added weight of water.

When is the wet unit weight most important?

Wet unit weight is crucial for calculations involving soil in its natural, moist, or saturated state. This includes foundation design (bearing capacity, settlement), slope stability analysis, earth pressure calculations, and estimating the weight of excavation or fill material.

Can wet unit weight be less than dry unit weight?

No, by definition, wet unit weight accounts for the weight of water in addition to the soil solids. Therefore, it will always be equal to or greater than the dry unit weight.

What is the standard unit weight of water?

The standard unit weight of water (γw_unit) is approximately 9.81 kN/m³ (kilonewtons per cubic meter) or 62.4 lb/ft³ (pounds per cubic foot) at standard temperature and pressure. This value is frequently used in soil mechanics calculations.

How does compaction affect wet unit weight?

Compaction increases the density of the soil, thereby increasing its dry unit weight. If water content is maintained or increased during compaction, the wet unit weight will also increase. Higher compaction generally leads to higher unit weights.

What is the significance of specific gravity (Gs) in this calculation?

Specific gravity (Gs) represents the density of the soil solids relative to water. It's a fundamental property that links volume and weight relationships within the soil mass, particularly when calculating void ratio and deriving wet unit weight from parameters like Gs, S, and e.

Does the calculator handle different units?

Yes, the calculator accepts input for dry unit weight in either kN/m³ or lb/ft³. Ensure you use consistent units for your inputs. The primary result will be displayed in the same unit as your dry unit weight input.

What is the typical range for soil wet unit weight?

Typical wet unit weights for common soils range from about 16 to 24 kN/m³ (100 to 150 lb/ft³). Denser soils, heavily saturated soils, or soils with high mineral content can exceed these ranges.

© 2023 Your Company Name. All rights reserved.

Providing essential tools for accurate engineering calculations.

var unitOfWeight = 'kN/m³'; // Default unit function validateInput(id, min, max, label, unit) { var input = document.getElementById(id); var errorElement = document.getElementById(id + 'Error'); var value = parseFloat(input.value); var isValid = true; errorElement.style.display = 'none'; input.style.borderColor = '#ccc'; if (isNaN(value)) { errorElement.textContent = label + ' is required.'; errorElement.style.display = 'block'; input.style.borderColor = 'red'; isValid = false; } else if (min !== null && value max) { errorElement.textContent = label + ' cannot be greater than ' + max + ' ' + unit + '.'; errorElement.style.display = 'block'; input.style.borderColor = 'red'; isValid = false; } return isValid; } function getUnitWeightOfWater() { var dwInput = document.getElementById('dryUnitWeight'); var value = parseFloat(dwInput.value); if (dwInput.value.toLowerCase().includes('lb/ft')) { return 62.4; } return 9.81; // Default kN/m³ } function calculateWetUnitWeight() { var dw = document.getElementById('dryUnitWeight'); var wc = document.getElementById('waterContent'); var gs = document.getElementById('specificGravity'); var sd = document.getElementById('degreeOfSaturation'); var errorMessages = []; var isValidDryUnitWeight = validateInput('dryUnitWeight', 0, null, 'Dry Unit Weight', unitOfWeight); var isValidWaterContent = validateInput('waterContent', 0, 100, 'Water Content', '%'); var isValidSpecificGravity = validateInput('specificGravity', 1, 5, 'Specific Gravity', "); // Gs typically 2-3 var isValidDegreeOfSaturation = validateInput('degreeOfSaturation', 0, 100, 'Degree of Saturation', '%'); if (!isValidDryUnitWeight || !isValidWaterContent || !isValidSpecificGravity || !isValidDegreeOfSaturation) { return; } var dryUnitWeight = parseFloat(dw.value); var waterContent = parseFloat(wc.value) / 100; // Convert percentage to decimal var specificGravity = parseFloat(gs.value); var degreeOfSaturation = parseFloat(sd.value) / 100; // Convert percentage to decimal var unitWeightOfWater = getUnitWeightOfWater(); // Determine unit of weight for results display if (dw.value.toLowerCase().includes('lb/ft')) { unitOfWeight = 'lb/ft³'; unitWeightOfWater = 62.4; } else { unitOfWeight = 'kN/m³'; unitWeightOfWater = 9.81; } // Intermediate Calculations var voidRatio = (specificGravity * unitWeightOfWater / dryUnitWeight) – 1; var moistureUnitWeight = unitWeightOfWater; // Label refers to unit weight of water itself // Wet Unit Weight Calculation (using Gs, S, e) // Ensure void ratio is not negative (can happen with unrealistic inputs) if (voidRatio < 0) voidRatio = 0; var wetUnitWeight = ((specificGravity + degreeOfSaturation * voidRatio) / (1 + voidRatio)) * unitWeightOfWater; // Fallback calculation if parameters are problematic or for simple cases // If Degree of Saturation is not the primary driver, often γw = γd * (1 + w) is used // Let's prioritize the Gs, S, e formula for more comprehensive results. // However, let's ensure the results are reasonable and provide a check. var saturationCheck = (degreeOfSaturation * 100).toFixed(1) + '%'; // Display Results document.getElementById('primaryResult').textContent = wetUnitWeight.toFixed(2) + ' ' + unitOfWeight; document.getElementById('voidRatio').textContent = voidRatio.toFixed(3); document.getElementById('moistureUnitWeight').textContent = moistureUnitWeight.toFixed(2) + ' ' + unitOfWeight; document.getElementById('saturationCheck').textContent = saturationCheck; document.getElementById('resultContainer').style.display = 'block'; // Update chart data updateChart(dryUnitWeight, unitOfWeight); } function resetForm() { document.getElementById('dryUnitWeight').value = '18'; document.getElementById('waterContent').value = '25'; document.getElementById('specificGravity').value = '2.65'; document.getElementById('degreeOfSaturation').value = '100'; // Clear errors document.getElementById('dryUnitWeightError').textContent = ''; document.getElementById('dryUnitWeightError').style.display = 'none'; document.getElementById('waterContentError').textContent = ''; document.getElementById('waterContentError').style.display = 'none'; document.getElementById('specificGravityError').textContent = ''; document.getElementById('specificGravityError').style.display = 'none'; document.getElementById('degreeOfSaturationError').textContent = ''; document.getElementById('degreeOfSaturationError').style.display = 'none'; document.getElementById('dryUnitWeight').style.borderColor = '#ccc'; document.getElementById('waterContent').style.borderColor = '#ccc'; document.getElementById('specificGravity').style.borderColor = '#ccc'; document.getElementById('degreeOfSaturation').style.borderColor = '#ccc'; document.getElementById('primaryResult').textContent = '–'; document.getElementById('voidRatio').textContent = '–'; document.getElementById('moistureUnitWeight').textContent = '–'; document.getElementById('saturationCheck').textContent = '–'; document.getElementById('resultContainer').style.display = 'none'; // Reset chart updateChart(18, 'kN/m³'); // Use default values for reset chart } function copyResults() { var primaryResult = document.getElementById('primaryResult').textContent; var voidRatio = document.getElementById('voidRatio').textContent; var moistureUnitWeight = document.getElementById('moistureUnitWeight').textContent; var saturationCheck = document.getElementById('saturationCheck').textContent; var dryUnitWeightInput = document.getElementById('dryUnitWeight'); var waterContentInput = document.getElementById('waterContent'); var specificGravityInput = document.getElementById('specificGravity'); var degreeOfSaturationInput = document.getElementById('degreeOfSaturation'); var copyText = "— Soil Wet Unit Weight Calculation Results —\n\n"; copyText += "Primary Result: " + primaryResult + "\n"; copyText += "Void Ratio (e): " + voidRatio + "\n"; copyText += "Unit Weight of Water (γw_unit): " + moistureUnitWeight + "\n"; copyText += "Degree of Saturation (S): " + saturationCheck + "\n\n"; copyText += "— Input Assumptions —\n"; copyText += "Dry Unit Weight (γd): " + dryUnitWeightInput.value + " " + unitOfWeight + "\n"; copyText += "Water Content (w): " + waterContentInput.value + " %\n"; copyText += "Specific Gravity (Gs): " + specificGravityInput.value + "\n"; copyText += "Degree of Saturation (S): " + degreeOfSaturationInput.value + " %\n"; var textArea = document.createElement("textarea"); textArea.value = copyText; document.body.appendChild(textArea); textArea.select(); try { document.execCommand("copy"); alert("Results copied to clipboard!"); } catch (err) { console.error("Unable to copy text.", err); alert("Failed to copy results. Please copy manually."); } document.body.removeChild(textArea); } // Charting Logic var soilChart; // Global variable for chart instance function updateChart(baseDryUnitWeight, baseUnit) { var ctx = document.getElementById('soilChart').getContext('2d'); // If chart instance exists, destroy it before creating a new one if (soilChart) { soilChart.destroy(); } var waterContents = [0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100]; // Percent var wetUnitWeights = []; var dryUnitWeights = []; // Show dry unit weight as a constant line var specificGravity = parseFloat(document.getElementById('specificGravity').value) || 2.65; var unitWeightOfWater = (baseUnit === 'lb/ft³') ? 62.4 : 9.81; // Assume constant Gs and unit weight of water for chart // Vary water content from 0% to 100% for (var i = 0; i < waterContents.length; i++) { var wc_decimal = waterContents[i] / 100; var S_decimal = 1.0; // Chart assumes saturated condition for wet unit weight calculation trend // Recalculate void ratio based on the *initial* dry unit weight for chart consistency var e_chart = (specificGravity * unitWeightOfWater / baseDryUnitWeight) – 1; if (e_chart < 0) e_chart = 0; // Prevent negative void ratio var gamma_w_chart = ((specificGravity + S_decimal * e_chart) / (1 + e_chart)) * unitWeightOfWater; wetUnitWeights.push(gamma_w_chart); dryUnitWeights.push(baseDryUnitWeight); // Dry unit weight is constant for this chart } soilChart = new Chart(ctx, { type: 'line', data: { labels: waterContents.map(function(wc) { return wc + '%'; }), // Water Content (%) datasets: [{ label: 'Wet Unit Weight (' + baseUnit + ')', data: wetUnitWeights, borderColor: 'var(–primary-color)', backgroundColor: 'rgba(0, 74, 153, 0.1)', fill: true, tension: 0.1 }, { label: 'Dry Unit Weight (' + baseUnit + ')', data: dryUnitWeights, borderColor: 'var(–success-color)', borderDash: [5, 5], // Dashed line for dry unit weight fill: false, tension: 0 }] }, options: { responsive: true, maintainAspectRatio: false, scales: { x: { title: { display: true, text: 'Water Content (%)', color: 'var(–primary-color)', font: { weight: 'bold' } } }, y: { title: { display: true, text: 'Unit Weight (' + baseUnit + ')', color: 'var(–primary-color)', font: { weight: 'bold' } }, beginAtZero: true } }, plugins: { legend: { display: true, position: 'top', }, tooltip: { mode: 'index', intersect: false, } }, hover: { mode: 'nearest', intersect: true } } }); } // Initialize chart on page load with default values document.addEventListener('DOMContentLoaded', function() { resetForm(); // Set default inputs and call updateChart via resetForm // Ensure chart is updated based on the reset form values var initialDryWeight = parseFloat(document.getElementById('dryUnitWeight').value); updateChart(initialDryWeight, 'kN/m³'); // Use default kN/m³ for initial chart }); // Add a simple Chart.js script tag for Canvas functionality // In a real-world scenario, you would include this in the or before your script. // For this single-file output, we'll assume it's available globally or injected. // For the purpose of this HTML file generation, we'll add a placeholder comment. /* NOTE: For the Canvas chart to work, you need to include the Chart.js library. Add this line within your section: */

Leave a Comment