tadd ocean to simulation type - Granular.jl - Julia package for granular dynamics simulation
(HTM) git clone git://src.adamsgaard.dk/Granular.jl
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit 3d6d97cde628bafaecd2d428b7a58c147faba650
(DIR) parent ed06106295c2a593d7de8aba8e897e2843767423
(HTM) Author: Anders Damsgaard <andersd@riseup.net>
Date: Fri, 21 Apr 2017 16:35:42 -0400
add ocean to simulation type
Diffstat:
M src/SeaIce.jl | 1 +
M src/datatypes.jl | 38 +++++++++++++++----------------
A src/ocean.jl | 15 +++++++++++++++
M src/simulation.jl | 6 ++++--
4 files changed, 38 insertions(+), 22 deletions(-)
---
(DIR) diff --git a/src/SeaIce.jl b/src/SeaIce.jl
t@@ -17,5 +17,6 @@ include("interaction.jl")
include("temporal.jl")
include("temporal_integration.jl")
include("io.jl")
+include("ocean.jl")
end # module end
(DIR) diff --git a/src/datatypes.jl b/src/datatypes.jl
t@@ -82,24 +82,6 @@ type IceFloeArrays
contact_dynamic_friction
end
-## Top-level simulation type
-
-# Simulation-scope data
-type Simulation
- id::String
-
- time_iteration::Int
- time::Float64
- time_total::Float64
- time_step::Float64
- file_time_step::Float64 # 0.0: no output files
- file_number::Int
-
- ice_floes::Array{IceFloeCylindrical, 1}
- contact_pairs::Array{Array{Int, 1}, 1}
- overlaps::Array{Array{Float64, 1}, 1}
-end
-
#=
Type containing all relevant data from MOM6 NetCDF file. The ocean grid is a
staggered of Arakawa-C type, with north-east convention centered on the
t@@ -137,8 +119,6 @@ https://mom6.readthedocs.io/en/latest/api/generated/pages/Horizontal_indexing.ht
placement in `[xh, yh, zl, time]`.
* `e::Array{Float64, Int}`: interface height relative to mean sea level [m],
dimensions correspond to placement in `[xh, yq, zi, time]`.
-
-
=#
type Ocean
input_file::String
t@@ -163,3 +143,21 @@ type Ocean
h::Array{Float64, 4}
e::Array{Float64, 4}
end
+
+# Top-level simulation type
+type Simulation
+ id::String
+
+ time_iteration::Int
+ time::Float64
+ time_total::Float64
+ time_step::Float64
+ file_time_step::Float64
+ file_number::Int
+
+ ice_floes::Array{IceFloeCylindrical, 1}
+ contact_pairs::Array{Array{Int, 1}, 1}
+ overlaps::Array{Array{Float64, 1}, 1}
+
+ ocean::Ocean
+end
(DIR) diff --git a/src/ocean.jl b/src/ocean.jl
t@@ -0,0 +1,15 @@
+"Returns empty ocean type for initialization purposes."
+function createEmptyOcean()
+ return Ocean("",
+ zeros(1),
+ zeros(1),
+ zeros(1),
+ zeros(1),
+ zeros(1),
+ zeros(1),
+ zeros(1),
+ zeros(1,1,1,1),
+ zeros(1,1,1,1),
+ zeros(1,1,1,1),
+ zeros(1,1,1,1))
+end
(DIR) diff --git a/src/simulation.jl b/src/simulation.jl
t@@ -27,7 +27,8 @@ function createSimulation(;id::String="unnamed",
file_number::Int=0,
ice_floes=Array{IceFloeCylindrical, 1}[],
contact_pairs=Array{Int64, 1}[],
- overlaps=Array{Array{Float64, 1}, 1}[])
+ overlaps=Array{Array{Float64, 1}, 1}[],
+ ocean::Ocean=createEmptyOcean())
return Simulation(id,
time_iteration,
t@@ -38,7 +39,8 @@ function createSimulation(;id::String="unnamed",
file_number,
ice_floes,
contact_pairs,
- overlaps)
+ overlaps,
+ ocean)
end
"""