Skip to content

Commit

Permalink
Added effective stress output file. Fixed effective stress graph to s…
Browse files Browse the repository at this point in the history
…how effective stress after applying load
  • Loading branch information
EmilSoleymani committed Aug 19, 2022
1 parent cc2fe2d commit 8636891
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/OutputFormat/CalculationBehaviour.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ using PrettyTables
include("../InputParser.jl")
using .InputParser

export CalculationOutputBehaviour, ConsolidationSwellCalculationBehaviour, LeonardFrostCalculationBehaviour, SchmertmannCalculationBehaviour, SchmertmannElasticCalculationBehaviour, CollapsibleSoilCalculationBehaviour, writeCalculationOutput, getCalculationOutput, getCalculationValue, getEffectiveStress, getSurchargePressure, getValue, schmertmannApproximation
export CalculationOutputBehaviour, ConsolidationSwellCalculationBehaviour, LeonardFrostCalculationBehaviour, SchmertmannCalculationBehaviour, SchmertmannElasticCalculationBehaviour, CollapsibleSoilCalculationBehaviour, writeCalculationOutput, getCalculationOutput, getCalculationValue, getEffectiveStress, getSurchargePressure, getValue, schmertmannApproximation, toFixed

# For now these will be hardcoded into here, later they will
# be part of a module of constants
Expand Down
39 changes: 38 additions & 1 deletion src/OutputFormat/OutputFormat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,17 @@ function writeOutput(order::Array{Function}, outputData::OutputData, path::Strin
end
end
end

"""
"""
function writeDefaultOutput(outputData::OutputData, path::String)
# Write all content to output file in default order
writeOutput([getHeader, performGetModelOutput, performGetFoundationOutput, getFoundationDepth, getSoilTable, getMaterialInfoTable, getDepthToGroundWaterTable, performGetDisplacementOutput, performGetEquilibriumOutput, performGetForcePointOutput, performGetCalculationOutput], outputData, path)

# Path of effective stress file is <file>.eff.dat
effPath = path[1:end-3]*"eff.dat"
# Write effective stress values to file at effPath
writeEffectiveStresses(outputData, effPath)
end


Expand Down Expand Up @@ -175,6 +184,35 @@ performWriteCalculationOutput(outputData::OutputData, path::String) = Calculatio
performGetCalculationOutput(outputData::OutputData) = CalculationBehaviour.getCalculationOutput(getCalculationOutputBehaviour(outputData))
performGetCalculationValue(outputData) = CalculationBehaviour.getCalculationValue(getCalculationOutputBehaviour(outputData))

function writeEffectiveStresses(outputData, outputPath::String)
# Get values from Behaviour instances getValue() function
vals = performGetCalculationValue(outputData)

# Arrays P and PP are always first two values return by any behaviour instances getValue() function
P = vals[1]
PP = vals[2]

# Create Stresses Table
stressTable::Array{Union{Int, Float64}} = []
for i=1:size(P)[1]
if size(stressTable)[1] == 0
stressTable = [Int(i) PP[i] P[i]]
else
stressTable = vcat(stressTable, [Int(i) PP[i] P[i]])
end
end

# Get units
pressureUnit = (outputData.inputData.units == Int(InputParser.Imperial)) ? "tsf" : "Pa"

# Create Table
table = pretty_table(String, stressTable; header = ["Soil Layer", "Effective Stress of Soil ($(pressureUnit))", "Effective Stress After Placing Load ($(pressureUnit))"],tf = tf_markdown)

# Write Table
open(outputPath, "w") do file
write(file, "Effective Stresses of Soil Profile\n\n" * table)
end
end
####################################


Expand Down Expand Up @@ -296,5 +334,4 @@ function getData(path::String)
return (outputData, outputData.inputData)
end


end # module
8 changes: 4 additions & 4 deletions src/vdisp.jl
Original file line number Diff line number Diff line change
Expand Up @@ -483,8 +483,8 @@ on(createOutputData) do val
end
graphData = Observable(false)
on(graphData) do val
if val
println("Graphing...")
if val # Only graph when graphData is changed to true
debugPrint("Graphing Data...")

if model[] == Int(InputParser.ConsolidationSwell)
table1 = outputData[][4] # heaveAboveFoundationTable
Expand Down Expand Up @@ -519,7 +519,7 @@ on(graphData) do val
end

# Prepare effective stress vs depth data
effectiveStress = outputData[][3]
effectiveStress = outputData[][2]

# Get material number of each sublayer, and dx of each layer
soilSublayerMats = []
Expand Down Expand Up @@ -671,7 +671,7 @@ on(graphData) do val
Base.invokelatest(display, plt)
end

println("Done")
debugPrint("Done")
end
end

Expand Down

0 comments on commit 8636891

Please sign in to comment.