Python - Drainage Hooghoudt Equation

by matt392 in Circuits > Software

38 Views, 1 Favorites, 0 Comments

Python - Drainage Hooghoudt Equation

drainage.jpg
DrainageEquation2.png
water-pollution.jpg
Python code to calculate Drainage Hooghoudt Equation below and attached.
print ("This program will calculate the discharge rate using the Drainage Hooghoudt Equation.")

import math

###  Formula for calculating the drainage discharge rate:
#  DrainageDischargeRate = ((8*HydraulicConductivitySoilBelowDrainLevel*EquivalentDepth)
# * (DepthImpermeableLayer-DepthDrains) * (DepthDrains-DepthWatertable)
# + (4*HydraulicConductivitySoil) * (DepthDrains-DepthWatertable) )/(SpacingBetweenDrains**2)
###############################################################################

# Enter the HydraulicConductivitySoilBelowDrainLevel, HydraulicConductivitySoilAboveDrainLevel,
# EquivalentDepth, DepthImpermeableLayer, DepthDrains, DepthWatertable, SpacingBetweenDrains

ContinueCalculations = "y"

def CalculateDrainageDischargeRate():
    print ("Calculating the Drainage Discharge Rate.")
    # Enter the HydraulicConductivitySoilBelowDrainLevel
    HydraulicConductivitySoilBelowDrainLevel = float(input("Enter the Hydraulic Conductivity of the soil below drain level: ") )

    # Enter the HydraulicConductivitySoilAboveDrainLevel
    HydraulicConductivitySoilAboveDrainLevel = float(input("Enter the Hydraulic Conductivity of the soil above drain level: ") )

    # Enter the Equivalent Depth
    EquivalentDepth = float(input("Enter the Equivalent Depth: ") )
    
    # Enter the DepthImpermeableLayer
    DepthImpermeableLayer = float(input("Enter the Depth of the Impermeable Layer below the drain level: ") )

    # Enter the DepthDrains
    DepthDrains = float(input("Enter the Depth of the Drains (must be less than Depth of Impermeable Layer): "))

    # Enter the DepthWatertable
    DepthWatertable = float(input("Enter the depth of the watertable midway between the drains (must be less than the Depth of Drains): "))

    # Enter SpacingBetweenDrains
    SpacingBetweenDrains = float(input("Enter the Spacing Between Drains: "))

# DrainageDischargeRate = ((8*HydraulicConductivitySoilBelowDrainLevel*EquivalentDepth) * (DepthImpermeableLayer-DepthDrains)
# * (DepthDrains-DepthWatertable) + (4*HydraulicConductivitySoilAboveDrainLevel) * (DepthDrains-DepthWatertable) )
# /(SpacingBetweenDrains**2)
    
    # Calculate the top of the fraction
    TopOfFraction = (8*HydraulicConductivitySoilBelowDrainLevel*EquivalentDepth) * (DepthImpermeableLayer-DepthDrains) * (DepthDrains-DepthWatertable) + (4*HydraulicConductivitySoilAboveDrainLevel) * ((DepthDrains-DepthWatertable)**2)

    # Calculate the bottom of the fraction
    BottomOfFraction = SpacingBetweenDrains**2

    DrainageDischargeRate = TopOfFraction/BottomOfFraction

    print("The Discharge Rate is: ", DrainageDischargeRate)

while (ContinueCalculations=="y"):
    CalculateDrainageDischargeRate()
    ContinueCalculations = str(input("Would you like to continue to calculate the Drainage Discharge Rate? (y/n): "))

print("==================================")
print ("Thank you to www.fxsolver.com for assistance with this formula.")