feat: modifed structure into a Julia compliant package

Added Project.toml and Manifest.toml.
Moved sourcecode to julia/TUG/src/

[skip ci]
This commit is contained in:
nebmit 2023-12-04 09:15:08 +01:00
parent 7331e45eea
commit 9f952c91b0
No known key found for this signature in database
25 changed files with 299 additions and 122 deletions

164
julia/TUG/Manifest.toml Normal file
View File

@ -0,0 +1,164 @@
# This file is machine-generated - editing it directly is not advised
julia_version = "1.9.3"
manifest_format = "2.0"
project_hash = "c12378c1474a9f436f3c2efe546b0b3a8f3832ef"
[[deps.ArgTools]]
uuid = "0dad84c5-d112-42e6-8d28-ef12dabb789f"
version = "1.1.1"
[[deps.Artifacts]]
uuid = "56f22d72-fd6d-98f1-02f0-08ddc0907c33"
[[deps.Base64]]
uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
[[deps.CompilerSupportLibraries_jll]]
deps = ["Artifacts", "Libdl"]
uuid = "e66e0078-7015-5450-92f7-15fbd957f2ae"
version = "1.0.5+0"
[[deps.Dates]]
deps = ["Printf"]
uuid = "ade2ca70-3891-5945-98fb-dc099432e06a"
[[deps.Distributed]]
deps = ["Random", "Serialization", "Sockets"]
uuid = "8ba89e20-285c-5b6f-9357-94700520ee1b"
[[deps.Downloads]]
deps = ["ArgTools", "FileWatching", "LibCURL", "NetworkOptions"]
uuid = "f43a241f-c20a-4ad4-852c-f6b1247861c6"
version = "1.6.0"
[[deps.FileWatching]]
uuid = "7b1f6079-737a-58dc-b8bc-7a2ca5c1b5ee"
[[deps.InteractiveUtils]]
deps = ["Markdown"]
uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
[[deps.LibCURL]]
deps = ["LibCURL_jll", "MozillaCACerts_jll"]
uuid = "b27032c2-a3e7-50c8-80cd-2d36dbcbfd21"
version = "0.6.3"
[[deps.LibCURL_jll]]
deps = ["Artifacts", "LibSSH2_jll", "Libdl", "MbedTLS_jll", "Zlib_jll", "nghttp2_jll"]
uuid = "deac9b47-8bc7-5906-a0fe-35ac56dc84c0"
version = "7.84.0+0"
[[deps.LibGit2]]
deps = ["Base64", "NetworkOptions", "Printf", "SHA"]
uuid = "76f85450-5226-5b5a-8eaa-529ad045b433"
[[deps.LibSSH2_jll]]
deps = ["Artifacts", "Libdl", "MbedTLS_jll"]
uuid = "29816b5a-b9ab-546f-933c-edad1886dfa8"
version = "1.10.2+0"
[[deps.Libdl]]
uuid = "8f399da3-3557-5675-b5ff-fb832c97cbdb"
[[deps.LinearAlgebra]]
deps = ["Libdl", "OpenBLAS_jll", "libblastrampoline_jll"]
uuid = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
[[deps.Logging]]
uuid = "56ddb016-857b-54e1-b83d-db4d58db5568"
[[deps.Markdown]]
deps = ["Base64"]
uuid = "d6f4376e-aef5-505a-96c1-9c027394607a"
[[deps.MbedTLS_jll]]
deps = ["Artifacts", "Libdl"]
uuid = "c8ffd9c3-330d-5841-b78e-0817d7145fa1"
version = "2.28.2+0"
[[deps.MozillaCACerts_jll]]
uuid = "14a3606d-f60d-562e-9121-12d972cd8159"
version = "2022.10.11"
[[deps.NetworkOptions]]
uuid = "ca575930-c2e3-43a9-ace4-1e988b2c1908"
version = "1.2.0"
[[deps.OpenBLAS_jll]]
deps = ["Artifacts", "CompilerSupportLibraries_jll", "Libdl"]
uuid = "4536629a-c528-5b80-bd46-f80d51c5b363"
version = "0.3.21+4"
[[deps.Pkg]]
deps = ["Artifacts", "Dates", "Downloads", "FileWatching", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "Serialization", "TOML", "Tar", "UUIDs", "p7zip_jll"]
uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
version = "1.9.2"
[[deps.Printf]]
deps = ["Unicode"]
uuid = "de0858da-6303-5e67-8744-51eddeeeb8d7"
[[deps.REPL]]
deps = ["InteractiveUtils", "Markdown", "Sockets", "Unicode"]
uuid = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb"
[[deps.Random]]
deps = ["SHA", "Serialization"]
uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
[[deps.SHA]]
uuid = "ea8e919c-243c-51af-8825-aaa63cd721ce"
version = "0.7.0"
[[deps.Serialization]]
uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b"
[[deps.Sockets]]
uuid = "6462fe0b-24de-5631-8697-dd941f90decc"
[[deps.SparseArrays]]
deps = ["Libdl", "LinearAlgebra", "Random", "Serialization", "SuiteSparse_jll"]
uuid = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
[[deps.SuiteSparse_jll]]
deps = ["Artifacts", "Libdl", "Pkg", "libblastrampoline_jll"]
uuid = "bea87d4a-7f5b-5778-9afe-8cc45184846c"
version = "5.10.1+6"
[[deps.TOML]]
deps = ["Dates"]
uuid = "fa267f1f-6049-4f14-aa54-33bafae1ed76"
version = "1.0.3"
[[deps.Tar]]
deps = ["ArgTools", "SHA"]
uuid = "a4e569a6-e804-4fa4-b0f3-eef7a1d5b13e"
version = "1.10.0"
[[deps.UUIDs]]
deps = ["Random", "SHA"]
uuid = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"
[[deps.Unicode]]
uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5"
[[deps.Zlib_jll]]
deps = ["Libdl"]
uuid = "83775a58-1f1d-513f-b197-d71354ab007a"
version = "1.2.13+0"
[[deps.libblastrampoline_jll]]
deps = ["Artifacts", "Libdl"]
uuid = "8e850b90-86db-534c-a0d3-1478176c7d93"
version = "5.8.0+0"
[[deps.nghttp2_jll]]
deps = ["Artifacts", "Libdl"]
uuid = "8e850ede-7688-5339-a07c-302acd2aaf8d"
version = "1.48.0+0"
[[deps.p7zip_jll]]
deps = ["Artifacts", "Libdl"]
uuid = "3f19e933-33d8-53b3-aaab-bd5110c3b7a0"
version = "17.4.0+0"

10
julia/TUG/Project.toml Normal file
View File

@ -0,0 +1,10 @@
name = "TUG"
uuid = "51875687-bb9f-4250-a034-1152304c8309"
authors = ["nebmit <76664673+nebmit@users.noreply.github.com>"]
version = "0.1.0"
[deps]
Distributed = "8ba89e20-285c-5b6f-9357-94700520ee1b"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"

View File

@ -1,14 +1,43 @@
using Printf
include("Boundary.jl")
include("Grid.jl")
@enum APPROACH BTCS FTCS
@enum CONSOLE_OUTPUT CONSOLE_OUTPUT_OFF CONSOLE_OUTPUT_ON CONSOLE_OUTPUT_VERBOSE
@enum CSV_OUTPUT CSV_OUTPUT_OFF CSV_OUTPUT_ON CSV_OUTPUT_VERBOSE CSV_OUTPUT_XTREME
abstract type AbstractSimulation{T} end
function adjustTimestep(grid::Grid{T}, approach::APPROACH, timestep::T, iterations::Int, verbose::Bool)::Tuple{T,Int} where {T}
if approach == FTCS
if getDim(grid) == 1
deltaSquare = getDeltaCol(grid)
maxAlpha = maximum(getAlphaX(grid))
# Courant-Friedrichs-Lewy condition
cfl = deltaSquare / (4 * maxAlpha)
elseif getDim(grid) == 2
deltaColSquare = getDeltaCol(grid) * getDeltaCol(grid)
deltaRowSquare = getDeltaRow(grid) * getDeltaRow(grid)
minDeltaSquare = min(deltaColSquare, deltaRowSquare)
maxAlpha = min(maximum(getAlphaX(grid)), maximum(getAlphaY(grid)))
cfl = minDeltaSquare / (4 * maxAlpha)
end
if timestep > cfl
innerIterations = ceil(Int, timestep / cfl)
iterations = iterations * innerIterations
timestep = timestep / innerIterations
if verbose
println("Warning: Timestep is too large for FTCS approach. Adjusting timestep to ", timestep, " and iterations to ", iterations, ".")
end
else
timestep = timestep
end
end
return timestep, iterations
end
function createCSVfile(simulation::AbstractSimulation{T}, grid::Union{Grid{T},Nothing}=nothing)::IOStream where {T}
grid = grid === nothing ? simulation.grid : grid
approachString = string(simulation.approach)

View File

@ -3,12 +3,9 @@
# condition at the edges of the diffusion grid.
# Translated from C++'s Boundary.hpp.
include("Grid.jl")
@enum TYPE CLOSED CONSTANT
@enum SIDE LEFT = 1 RIGHT = 2 TOP = 3 BOTTOM = 4
# BoundaryElement class
struct BoundaryElement{T}
type::TYPE
value::T
@ -17,7 +14,12 @@ struct BoundaryElement{T}
BoundaryElement{T}() where {T} = new{T}(CLOSED, convert(T, -1))
# Constructor for constant case
BoundaryElement{T}(value::T) where {T} = new{T}(CONSTANT, value)
function BoundaryElement{T}(value::T) where {T}
if value < 0
throw(ArgumentError("No negative concentration allowed."))
end
new{T}(CONSTANT, value)
end
end
function getType(be::BoundaryElement{T})::TYPE where {T}
@ -32,23 +34,6 @@ function getValue(be::Vector{BoundaryElement{T}})::Vector{T} where {T}
[b.value for b in be]
end
function setType!(be::BoundaryElement{T}, type::Symbol) where {T}
be.type = type
end
function setValue!(be::BoundaryElement{T}, value::T) where {T}
if value < 0
throw(ArgumentError("No negative concentration allowed."))
end
if be.type == BC_TYPE_CLOSED
throw(ArgumentError("No constant boundary concentrations can be set for closed boundaries. Please change type first."))
end
be.value = value
end
# Boundary class
struct Boundary{T}
dim::UInt8
cols::UInt32

View File

@ -8,10 +8,6 @@ using Base.Threads
using LinearAlgebra
using SparseArrays
include("../Boundary.jl")
include("../Grid.jl")
include("Utils.jl")
function calcBoundaryCoeffClosed(alpha_center::T, alpha_side::T, sx::T) where {T}
alpha = calcAlphaIntercell(alpha_center, alpha_side)
centerCoeff = 1 + sx * alpha

View File

@ -7,10 +7,6 @@ using Base.Threads
using LinearAlgebra
using SparseArrays
include("../Boundary.jl")
include("../Grid.jl")
include("Utils.jl")
function calcHorizontalChange(alphaX_next::T, alphaX_prev::T, alphaX_current::T,
concentration_next::T, concentration_prev::T, concentration_current::T) where {T}

View File

@ -1,4 +1,3 @@
function calcAlphaIntercell(alpha1::T, alpha2::T) where {T}
2 / ((1 / alpha1) + (1 / alpha2))
end

View File

@ -1,11 +1,5 @@
using Distributed
include("AbstractSimulation.jl")
include("Boundary.jl")
include("Core/BTCS.jl")
include("Core/FTCS.jl")
include("Grid.jl")
struct DynamicSimulation{T} <: AbstractSimulation{T}
grid::Grid{T}
grids::Vector{Grid{T}}
@ -17,7 +11,7 @@ struct DynamicSimulation{T} <: AbstractSimulation{T}
# Constructor
function DynamicSimulation(grid::Grid{T}, bc::Boundary{T}, approach::APPROACH, timestep::T) where {T}
timestep, iterations = adjustTimestep(grid, approach, timestep, 1)
timestep, iterations = adjustTimestep(grid, approach, timestep, 1, false)
new{T}(grid, Vector{Grid{T}}(), bc, approach, iterations, timestep)
end
end

View File

@ -5,7 +5,6 @@
using LinearAlgebra
# Grid class
struct Grid{T}
cols::Int
rows::Int
@ -21,15 +20,17 @@ struct Grid{T}
alphaY_t::Union{Ref{Matrix{T}},Nothing}
# Constructor for 1D-Grid
function Grid{T}(length::Int, alpha::Matrix{T}) where {T}
function Grid{T}(length::Int, alphaX::Matrix{T}) where {T}
if length <= 3
throw(ArgumentError("Given grid length too small. Must be greater than 3."))
end
if size(alpha, 1) != 1 || size(alpha, 2) != length
error("Given matrix of alpha coefficients mismatch with Grid dimensions!")
if size(alphaX, 1) != 1 || size(alphaX, 2) != length
throw(ArgumentError("Given matrix of alpha coefficients mismatch with Grid dimensions!"))
end
new{T}(length, 1, 1, T(length), 0, T(1), 0, Ref(fill(T(0), 1, length)), alpha, nothing, nothing, nothing)
alphaX_t = alphaX'
new{T}(length, 1, 1, T(length), 0, T(1), 0, Ref(fill(T(0), 1, length)), alphaX, nothing, alphaX_t, nothing)
end
# Constructor for 2D-Grid
@ -38,7 +39,7 @@ struct Grid{T}
throw(ArgumentError("Given grid dimensions too small. Must each be greater than 3."))
end
if size(alphaX) != (rows, cols) || size(alphaY) != (rows, cols)
error("Given matrices of alpha coefficients mismatch with Grid dimensions!")
throw(ArgumentError("Given matrices of alpha coefficients mismatch with Grid dimensions!"))
end
# Precompute alphaX_t and alphaY_t
@ -54,6 +55,9 @@ struct Grid{T}
end
function clone(grid::Grid{T})::Grid{T} where {T}
if grid.dim == 1
return Grid{T}(1, grid.cols, grid.dim, grid.domainCol, grid.domainRow, grid.deltaCol, grid.deltaRow, Ref(copy(grid.concentrations[])), Ref(copy(grid.alphaX[])), nothing, Ref(copy(grid.alphaX_t[])), nothing)
end
Grid{T}(grid.rows, grid.cols, grid.dim, grid.domainCol, grid.domainRow, grid.deltaCol, grid.deltaRow, Ref(copy(grid.concentrations[])), Ref(copy(grid.alphaX[])), Ref(copy(grid.alphaY[])), Ref(copy(grid.alphaX_t[])), Ref(copy(grid.alphaY_t[])))
end
@ -62,6 +66,10 @@ function getAlphaX(grid::Grid{T})::Matrix{T} where {T}
end
function getAlphaY(grid::Grid{T})::Matrix{T} where {T}
if grid.dim == 1
error("Grid is 1D, so there is no alphaY matrix!")
end
grid.alphaY[]
end
@ -70,6 +78,10 @@ function getAlphaX_t(grid::Grid{T})::Matrix{T} where {T}
end
function getAlphaY_t(grid::Grid{T})::Matrix{T} where {T}
if grid.dim == 1
error("Grid is 1D, so there is no alphaY_t matrix!")
end
grid.alphaY_t[]
end
@ -98,15 +110,30 @@ function getRows(grid::Grid{T})::Int where {T}
end
function setAlphaX!(grid::Grid{T}, new_alphaX::Matrix{T}) where {T}
if size(new_alphaX) != size(grid.alphaX[])
throw(ArgumentError("Given matrix of alpha coefficients mismatch with Grid dimensions!"))
end
grid.alphaX[] = new_alphaX
grid.alphaX_t[] = new_alphaX'
end
function setAlphaY!(grid::Grid{T}, new_alphaY::Matrix{T}) where {T}
if grid.dim == 1
error("Grid is 1D, so there is no alphaY matrix!")
end
if size(new_alphaY) != size(grid.alphaY[])
throw(ArgumentError("Given matrix of alpha coefficients mismatch with Grid dimensions!"))
end
grid.alphaY[] = new_alphaY
grid.alphaY_t[] = new_alphaY'
end
function setConcentrations!(grid::Grid{T}, new_concentrations::Matrix{T}) where {T}
if size(new_concentrations) != size(grid.concentrations[])
throw(ArgumentError("Given matrix of concentrations mismatch with Grid dimensions!"))
end
grid.concentrations[] = new_concentrations
end

View File

@ -4,13 +4,6 @@
# options. Simulation object also holds a predefined Grid and Boundary object.
# Translated from C++'s Simulation.hpp.
include("AbstractSimulation.jl")
include("Boundary.jl")
include("Core/BTCS.jl")
include("Core/FTCS.jl")
include("Grid.jl")
# Simulation class
struct Simulation{T} <: AbstractSimulation{T}
grid::Grid{T}
bc::Boundary{T}
@ -29,36 +22,6 @@ struct Simulation{T} <: AbstractSimulation{T}
end
end
function adjustTimestep(grid::Grid{T}, approach::APPROACH, timestep::T, iterations::Int)::Tuple{T,Int} where {T}
if approach == FTCS
if getDim(grid) == 1
deltaSquare = getDeltaCol(grid)
maxAlpha = maximum(getAlphaX(grid))
# Courant-Friedrichs-Lewy condition
cfl = deltaSquare / (4 * maxAlpha)
elseif getDim(grid) == 2
deltaColSquare = getDeltaCol(grid) * getDeltaCol(grid)
deltaRowSquare = getDeltaRow(grid) * getDeltaRow(grid)
minDeltaSquare = min(deltaColSquare, deltaRowSquare)
maxAlpha = min(maximum(getAlphaX(grid)), maximum(getAlphaY(grid)))
cfl = minDeltaSquare / (4 * maxAlpha)
end
if timestep > cfl
innerIterations = ceil(Int, timestep / cfl)
iterations = iterations * innerIterations
timestep = timestep / innerIterations
println("Warning: Timestep is too large for FTCS approach. Adjusting timestep to ", timestep, " and iterations to ", iterations, ".")
else
timestep = timestep
end
end
return timestep, iterations
end
function run(simulation::Simulation{T}) where {T}
file = nothing
try
@ -78,7 +41,7 @@ function run(simulation::Simulation{T}) where {T}
if simulation.approach == BTCS
runBTCS(simulation.grid, simulation.bc, simulation.timestep, simulation.iterations, simulationStepCallback)
elseif simulation.approach == FTCS
timestep, iterations = adjustTimestep(simulation.grid, simulation.approach, simulation.timestep, simulation.iterations)
timestep, iterations = adjustTimestep(simulation.grid, simulation.approach, simulation.timestep, simulation.iterations, simulation.consoleOutput >= CONSOLE_OUTPUT_VERBOSE)
runFTCS(simulation.grid, simulation.bc, timestep, iterations, simulationStepCallback)
else
error("Undefined approach!")

View File

@ -1,5 +1,15 @@
module TUG
include("Grid.jl")
export Grid
export getAlphaX, getAlphaY, getConcentrations, setConcentrations!, setAlphaX!, setAlphaY!, getDomainCol, getDomainRow, getDeltaCol, getDeltaRow, getDim
include("Boundary.jl")
export Boundary, BoundaryElement, TYPE, SIDE, BC_TYPE_CLOSED, BC_TYPE_CONSTANT, LEFT, RIGHT, TOP, BOTTOM
export getType, getValue, setBoundarySideClosed!, setBoundarySideConstant!, getBoundarySide, getBoundaryElementType, getBoundaryElementValue
include("AbstractSimulation.jl")
export AbstractSimulation, APPROACH, CONSOLE_OUTPUT, CSV_OUTPUT, BTCS, FTCS, CONSOLE_OUTPUT_OFF, CONSOLE_OUTPUT_ON, CONSOLE_OUTPUT_VERBOSE, CSV_OUTPUT_OFF, CSV_OUTPUT_ON, CSV_OUTPUT_VERBOSE, CSV_OUTPUT_XTREME
@ -14,16 +24,7 @@ include("DynamicSimulation.jl")
export DynamicSimulation
export createGrid, getConcentrations, setConcentrations!, setAlphaX!, setAlphaY!, next, printConcentrationsCSV, printConcentrations
include("Boundary.jl")
export Boundary, BoundaryElement, TYPE, SIDE, BC_TYPE_CLOSED, BC_TYPE_CONSTANT, LEFT, RIGHT, TOP, BOTTOM
export getType, getValue, setValue!, setBoundarySideClosed!, setBoundarySideConstant!, getBoundarySide, getBoundarySideClosed, getBoundarySideConstant
include("Grid.jl")
export Grid
export getAlphaX, getAlphaY, getConcentrations, setConcentrations!, setAlphaX!, setAlphaY!, getDomainCol, getDomainRow, getDeltaCol, getDeltaRow, getDim
include("Core/Utils.jl")
include("Core/BTCS.jl")
include("Core/FTCS.jl")

View File

@ -4,7 +4,7 @@ using DataFrames
using Distributed
using Statistics
include("../tug/TUG.jl")
include("../TUG/src/TUG.jl")
using .TUG
# 1. Environment Setup
@ -14,7 +14,7 @@ function setup_environment(num_procs::Int)
# Use remotecall to include TUG on each new worker
for proc in added_procs
remotecall_wait(include, proc, "../tug/TUG.jl")
remotecall_wait(include, proc, "../TUG/src/TUG.jl")
remotecall_wait(eval, proc, :(using .TUG))
end
end

View File

@ -1,4 +1,5 @@
include("../../tug/Simulation.jl")
include("../../TUG/src/TUG.jl")
using .TUG
function main()
# **** GRID ****
@ -29,7 +30,7 @@ function main()
simulation = setOutputCSV(simulation, CSV_OUTPUT_ON)
# **** RUN SIMULATION ****
print((@elapsed run(simulation)) * 1e9)
print((@elapsed TUG.run(simulation)) * 1e9)
end
main()

View File

@ -1,4 +1,5 @@
include("../../tug/Simulation.jl")
include("../../TUG/src/TUG.jl")
using .TUG
function main()
# **** GRID ****
@ -35,7 +36,7 @@ function main()
simulation = setOutputCSV(simulation, CSV_OUTPUT_ON)
# **** RUN SIMULATION ****
print((@elapsed run(simulation)) * 1e9)
print((@elapsed TUG.run(simulation)) * 1e9)
end
main()

View File

@ -1,4 +1,5 @@
include("../../tug/Simulation.jl")
include("../../TUG/src/TUG.jl")
using .TUG
function main()
# **** GRID ****
@ -24,7 +25,7 @@ function main()
simulation = setOutputCSV(simulation, CSV_OUTPUT_ON)
# **** RUN SIMULATION ****
print((@elapsed run(simulation)) * 1e9)
print((@elapsed TUG.run(simulation)) * 1e9)
end
main()

View File

@ -1,4 +1,5 @@
include("../../tug/Simulation.jl")
include("../../TUG/src/TUG.jl")
using .TUG
function main()
# **** GRID ****
@ -26,7 +27,7 @@ function main()
simulation = setOutputCSV(simulation, CSV_OUTPUT_ON)
# **** RUN SIMULATION ****
print((@elapsed run(simulation)) * 1e9)
print((@elapsed TUG.run(simulation)) * 1e9)
end
main()

View File

@ -1,4 +1,5 @@
include("../../tug/Simulation.jl")
include("../../TUG/src/TUG.jl")
using .TUG
function main()
# **** GRID ****
@ -32,7 +33,7 @@ function main()
simulation = setOutputCSV(simulation, CSV_OUTPUT_ON)
# **** RUN SIMULATION ****
print((@elapsed run(simulation)) * 1e9)
print((@elapsed TUG.run(simulation)) * 1e9)
end
main()

View File

@ -1,4 +1,5 @@
include("../../tug/Simulation.jl")
include("../../TUG/src/TUG.jl")
using .TUG
function main()
# **** GRID ****
@ -28,7 +29,7 @@ function main()
simulation = setOutputCSV(simulation, CSV_OUTPUT_ON)
# **** RUN SIMULATION ****
print((@elapsed run(simulation)) * 1e9)
print((@elapsed TUG.run(simulation)) * 1e9)
end
main()

View File

@ -1,4 +1,5 @@
include("../../tug/Simulation.jl")
include("../../TUG/src/TUG.jl")
using .TUG
function main()
# **** GRID ****
@ -36,7 +37,7 @@ function main()
simulation = setOutputCSV(simulation, CSV_OUTPUT_ON)
# **** RUN SIMULATION ****
print((@elapsed run(simulation)) * 1e9)
print((@elapsed TUG.run(simulation)) * 1e9)
end
main()

View File

@ -1,4 +1,5 @@
include("../../tug/Simulation.jl")
include("../../TUG/src/TUG.jl")
using .TUG
function main()
# **** GRID ****
@ -35,7 +36,7 @@ function main()
simulation = setOutputCSV(simulation, CSV_OUTPUT_ON)
# **** RUN SIMULATION ****
print((@elapsed run(simulation)) * 1e9)
print((@elapsed TUG.run(simulation)) * 1e9)
end
main()

View File

@ -1,4 +1,5 @@
include("../../tug/Simulation.jl")
include("../../TUG/src/TUG.jl")
using .TUG
function main()
# **** GRID ****
@ -24,7 +25,7 @@ function main()
simulation = setOutputCSV(simulation, CSV_OUTPUT_ON)
# **** RUN SIMULATION ****
print((@elapsed run(simulation)) * 1e9)
print((@elapsed TUG.run(simulation)) * 1e9)
end
main()

View File

@ -1,4 +1,5 @@
include("../../tug/Simulation.jl")
include("../../TUG/src/TUG.jl")
using .TUG
function main()
# **** GRID ****
@ -29,7 +30,7 @@ function main()
simulation = setOutputCSV(simulation, CSV_OUTPUT_ON)
# **** RUN SIMULATION ****
print((@elapsed run(simulation)) * 1e9)
print((@elapsed TUG.run(simulation)) * 1e9)
end
main()

View File

@ -1,4 +1,5 @@
include("../../tug/Simulation.jl")
include("../../TUG/src/TUG.jl")
using .TUG
function main()
# **** GRID ****
@ -28,7 +29,7 @@ function main()
simulation = setOutputCSV(simulation, CSV_OUTPUT_ON)
# **** RUN SIMULATION ****
print((@elapsed run(simulation)) * 1e9)
print((@elapsed TUG.run(simulation)) * 1e9)
end
main()

View File

@ -1,4 +1,5 @@
include("../../tug/Simulation.jl")
include("../../TUG/src/TUG.jl")
using .TUG
function main()
# **** GRID ****
@ -36,7 +37,7 @@ function main()
simulation = setOutputCSV(simulation, CSV_OUTPUT_ON)
# **** RUN SIMULATION ****
print((@elapsed run(simulation)) * 1e9)
print((@elapsed TUG.run(simulation)) * 1e9)
end
main()

View File

@ -1,4 +1,5 @@
include("../../tug/Simulation.jl")
include("../../TUG/src/TUG.jl")
using .TUG
function main()
# **** GRID ****
@ -32,7 +33,7 @@ function main()
simulation = setOutputCSV(simulation, CSV_OUTPUT_ON)
# **** RUN SIMULATION ****
elapsed_time_ns = (@elapsed run(simulation)) * 1e9
elapsed_time_ns = (@elapsed TUG.run(simulation)) * 1e9
println("Simulation Time (nanoseconds): ", elapsed_time_ns)
end